Documentation
¶
Index ¶
- Constants
- func GetTableName(dest any) string
- type DBConn
- type Model
- func (m *Model) Asc(condition any) types.ORMModel
- func (m *Model) BulkWrite(datas any, order bool) error
- func (m *Model) Create(data any) (id string, err error)
- func (m *Model) Delete(data ...any) error
- func (m *Model) Desc(condition any) types.ORMModel
- func (m *Model) Find() types.ORMQuary
- func (m *Model) GetContext() context.Context
- func (m *Model) Limit(limit int) types.ORMModel
- func (m *Model) Offset(offset int) types.ORMModel
- func (m *Model) Page(page, limit int) types.ORMModel
- func (m *Model) Save(data any, value ...any) (id string, err error)
- func (m *Model) Session(transactionFunc func(sessionContext context.Context) error) error
- func (m *Model) SetContext(ctx context.Context) types.ORMModel
- func (m *Model) Update(data any, value ...any) error
- func (m *Model) Where(condition any, value ...any) types.ORMModel
- func (m *Model) WhereGt(condition any, value ...any) types.ORMModel
- func (m *Model) WhereGte(condition any, value ...any) types.ORMModel
- func (m *Model) WhereIs(key string, value any) types.ORMModel
- func (m *Model) WhereLt(condition any, value ...any) types.ORMModel
- func (m *Model) WhereLte(condition any, value ...any) types.ORMModel
- func (m *Model) WhereNot(condition any, value ...any) types.ORMModel
- func (m *Model) WhereOr(condition any, value ...any) types.ORMModel
- type Quary
- type Table
Constants ¶
View Source
const ( WhereIs = iota WhereNot WhereGt WhereLt WhereOr OrderAsc OrderDesc WhereGte WhereLte )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct {
Data any
OpList sync.Map // key:操作模式Mode value:操作值
Ctx context.Context //上下文
Table string
// contains filtered or unexported fields
}
func (*Model) BulkWrite ¶ added in v0.1.9
**
operations := []BulkWriteOperation{
{
Type: "insert",
Data: &User{Name: "Alice"},
},
{
Type: "update",
Data: &User{},
Where: map[string]any{"name": "Bob"},
Values: map[string]any{"age": 30},
},
{
Type: "delete",
Data: &User{},
Where: map[string]any{"name": "Charlie"},
},
}
err := model.BulkWrite(operations, true) **
func (*Model) GetContext ¶ added in v0.0.4
func (*Model) SetContext ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.