Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFoundSQLEngine = errors.New("not found sql engine")
)
Functions ¶
Types ¶
type Engine ¶
type Engine interface { Clone() Engine Bind(db *sql.DB) Close() error Name() string Current() (string, error) CreateDatabase(name string) error DropDatabase(name string) error CreateTable(name string, columns []driver.Column) error DropTable(name string) error Indexes(table string) ([]*driver.Index, error) CreateIndex(table string, index *driver.Index) error DropIndex(table string, name string) error Insert(table string, doc interface{}, opts *driver.InsertOptions) (*driver.InsertResult, error) Delete(table string, filter driver.Cond, opts *driver.DeleteOptions) (*driver.DeleteResult, error) Update(table string, filter driver.Cond, update interface{}, opts *driver.UpdateOptions) (*driver.UpdateResult, error) Query(table string, filter driver.Cond, opts *driver.QueryOptions) (driver.QueryResult, error) }
抽象不同数据库接口
null处理: https://github.com/guregu/null switch database:mysql虽然可以使用USE db实现切换,但最好不要做这样的操作,因为connection是有pool的 pg没有切换数据库这样的功能 只能通过重新创建新的连接的方式支持多数据库切换
type MySQLIndex ¶
Click to show internal directories.
Click to hide internal directories.