(store *Store, dbName string)
| 19 | } |
| 20 | |
| 21 | func NewDB(store *Store, dbName string) (*DB, error) { |
| 22 | if !IsValidName(dbName) { |
| 23 | return nil, errors.New("invalid database name '" + dbName + "'") |
| 24 | } |
| 25 | |
| 26 | return &DB{ |
| 27 | store: store, |
| 28 | name: dbName, |
| 29 | namespace: "$" + dbName + "$", |
| 30 | tableMap: map[string]TableInterface{}, |
| 31 | }, nil |
| 32 | } |
| 33 | |
| 34 | func (this *DB) AddTable(table TableInterface) { |
| 35 | table.SetNamespace([]byte(this.Namespace() + table.Name() + "$")) |