mirror of
https://github.com/chaisql/chai.git
synced 2025-10-25 08:32:44 +08:00
29 lines
560 B
Go
29 lines
560 B
Go
package engine
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/asdine/genji/index"
|
|
"github.com/asdine/genji/table"
|
|
)
|
|
|
|
// Errors.
|
|
var (
|
|
ErrNotFound = errors.New("not found")
|
|
)
|
|
|
|
type Engine interface {
|
|
Begin(writable bool) (Transaction, error)
|
|
Close() error
|
|
}
|
|
|
|
type Transaction interface {
|
|
Rollback() error
|
|
Commit() error
|
|
Table(name string) (table.Table, error)
|
|
CreateTable(name string) (table.Table, error)
|
|
Index(table, name string) (index.Index, error)
|
|
Indexes(table string) (map[string]index.Index, error)
|
|
CreateIndex(table, field string) (index.Index, error)
|
|
}
|