Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Cond
- func And(conds ...Cond) Cond
- func Eq(key string, value interface{}) Cond
- func Gt(key string, value interface{}) Cond
- func Gte(key string, value interface{}) Cond
- func In(key string, value interface{}) Cond
- func Lt(key string, value interface{}) Cond
- func Lte(key string, value interface{}) Cond
- func Ne(key string, value interface{}) Cond
- func Nin(key string, value interface{}) Cond
- func Nor(conds ...Cond) Cond
- func Not(cond Cond) Cond
- func Or(conds ...Cond) Cond
- type Database
- func (d *Database) CreateIndex(table string, keys interface{}, opts ...IndexOption) error
- func (d *Database) CreateTable(model interface{}) error
- func (d *Database) Delete(table string, filter Cond, opts ...DeleteOption) (*DeleteResult, error)
- func (d *Database) DeleteOne(table string, filter Cond, opts ...DeleteOption) (*DeleteResult, error)
- func (d *Database) DropIndex(table string, name string) error
- func (d *Database) DropTable(name string) error
- func (d *Database) Indexes(table string) ([]*Index, error)
- func (d *Database) Insert(table string, doc interface{}, opts ...InsertOption) (*InsertResult, error)
- func (d *Database) Query(table string, filter Cond, opts ...QueryOption) error
- func (d *Database) QueryOne(table string, filter Cond, opts ...QueryOption) (QueryResult, error)
- func (d *Database) Update(table string, filter Cond, update interface{}, opts ...UpdateOption) (*UpdateResult, error)
- func (d *Database) UpdateOne(table string, filter Cond, update interface{}, opts ...UpdateOption) (*UpdateResult, error)
- type DeleteOption
- type DeleteResult
- type Index
- type IndexKey
- type IndexOption
- type InsertOption
- type InsertResult
- type OpenOption
- type Order
- type QueryOption
- type QueryResult
- type Token
- type UpdateOption
- type UpdateResult
Constants ¶
View Source
const ( Asc = driver.Asc // 升序,默认 Desc = driver.Desc // 降序 )
Variables ¶
View Source
var ( ErrInvalidIndexKey = errors.New("invalid index key") ErrNotSupport = errors.New("not support") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Open ¶
func (c *Client) Open(opts ...OpenOption) error
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) CreateIndex ¶
func (d *Database) CreateIndex(table string, keys interface{}, opts ...IndexOption) error
创建索引,简单情况只需要传入列名即可,支持以下形式 d.CreateIndex("test", "uid") d.CreateIndex("test", []string{"uid", "create_time"}) d.CreateIndex("test", []orm.IndexKey{{Name:"uid", Order:orm.Desc}})
func (*Database) CreateTable ¶
CreateTable 会自动创建缺失的表,列,和索引,但不会删除和改变列类型
func (*Database) Delete ¶
func (d *Database) Delete(table string, filter Cond, opts ...DeleteOption) (*DeleteResult, error)
func (*Database) DeleteOne ¶
func (d *Database) DeleteOne(table string, filter Cond, opts ...DeleteOption) (*DeleteResult, error)
func (*Database) Insert ¶
func (d *Database) Insert(table string, doc interface{}, opts ...InsertOption) (*InsertResult, error)
func (*Database) Query ¶
func (d *Database) Query(table string, filter Cond, opts ...QueryOption) error
func (*Database) QueryOne ¶
func (d *Database) QueryOne(table string, filter Cond, opts ...QueryOption) (QueryResult, error)
func (*Database) Update ¶
func (d *Database) Update(table string, filter Cond, update interface{}, opts ...UpdateOption) (*UpdateResult, error)
func (*Database) UpdateOne ¶
func (d *Database) UpdateOne(table string, filter Cond, update interface{}, opts ...UpdateOption) (*UpdateResult, error)
type DeleteOption ¶
type DeleteOption func(options *driver.DeleteOptions)
type DeleteResult ¶
type DeleteResult = driver.DeleteResult
type IndexOption ¶
type InsertOption ¶
type InsertOption func(options *driver.InsertOptions)
type InsertResult ¶
type InsertResult = driver.InsertResult
type OpenOption ¶
type OpenOption func(options *driver.OpenOptions)
type QueryOption ¶
type QueryOption func(options *driver.QueryOptions)
type QueryResult ¶
type QueryResult = driver.QueryResult
type UpdateOption ¶
type UpdateOption func(options *driver.UpdateOptions)
type UpdateResult ¶
type UpdateResult = driver.UpdateResult
Click to show internal directories.
Click to hide internal directories.