Documentation ¶
Index ¶
- func Init(mas []config.Mysql, sls []config.Mysql)
- type Mysql
- func (m *Mysql[T]) AddSharding(key any) *Mysql[T]
- func (m *Mysql[T]) BatchInsert(key any, batch *ds.Batch) (int64, error)
- func (m *Mysql[T]) BatchInsertCtx(ctx context.Context, key any, batch *ds.Batch) (int64, error)
- func (m *Mysql[T]) Count(key any, table string, where ds.WhereInterface) (int64, error)
- func (m *Mysql[T]) CountCtx(ctx context.Context, key any, table string, where ds.WhereInterface) (int64, error)
- func (m *Mysql[T]) Delete(key any, del *ds.Delete) (int64, error)
- func (m *Mysql[T]) DeleteCtx(ctx context.Context, key any, del *ds.Delete) (int64, error)
- func (m *Mysql[T]) Exec(key any, statement string) error
- func (m *Mysql[T]) ExecCtx(ctx context.Context, key any, statement string) error
- func (m *Mysql[T]) FetchAll(key any, table string, where meta.Where, model T) ([]T, error)
- func (m *Mysql[T]) FetchAllByWhere(key any, table string, where ds.WhereInterface, model T) ([]T, error)
- func (m *Mysql[T]) FetchAllByWhereCtx(ctx context.Context, key any, table string, where ds.WhereInterface, model T) ([]T, error)
- func (m *Mysql[T]) FetchAllCtx(ctx context.Context, key any, table string, where meta.Where, model T) ([]T, error)
- func (m *Mysql[T]) FetchPage(key any, table string, where meta.Where, model T, page, pageSize int, ...) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchPageBySelect(key any, sel *ds.Select, model T) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchPageBySelectCtx(ctx context.Context, key any, sel *ds.Select, model T) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchPageByWhere(key any, table string, where ds.WhereInterface, model T, page, pageSize int, ...) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchPageByWhereCtx(ctx context.Context, key any, table string, where ds.WhereInterface, model T, ...) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchPageCtx(ctx context.Context, key any, table string, where meta.Where, model T, ...) (*meta.Page[T], error)
- func (m *Mysql[T]) FetchRow(key any, table string, where meta.Where, model T) error
- func (m *Mysql[T]) FetchRowCtx(ctx context.Context, key any, table string, where meta.Where, model T) error
- func (m *Mysql[T]) GetConnection(key int) *db.Mysql[T]
- func (m *Mysql[T]) GetShardingKey(key any) int
- func (m *Mysql[T]) Insert(key any, insert *ds.Insert) (int64, error)
- func (m *Mysql[T]) InsertCtx(ctx context.Context, key any, insert *ds.Insert) (int64, error)
- func (m *Mysql[T]) LockRow(key any, table string, where meta.Where, model T) error
- func (m *Mysql[T]) LockRowCtx(ctx context.Context, key any, table string, where meta.Where, model T) error
- func (m *Mysql[T]) Query(key any, query string, model T, args ...any) ([]T, error)
- func (m *Mysql[T]) QueryCtx(ctx context.Context, key any, query string, model T, args ...any) ([]T, error)
- func (m *Mysql[T]) Reset()
- func (m *Mysql[T]) Set(isMaster bool, tx *Tx)
- func (m *Mysql[T]) SetTx(tx *Tx)
- func (m *Mysql[T]) Transaction(f func(tx *Tx) error) error
- func (m *Mysql[T]) TransactionCtx(ctx context.Context, f func(tx *Tx) error, opts *sql.TxOptions) error
- func (m *Mysql[T]) Update(key any, update *ds.Update) (int64, error)
- func (m *Mysql[T]) UpdateCtx(ctx context.Context, key any, update *ds.Update) (int64, error)
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mysql ¶
type Mysql[T itf.ModelInterface] struct { // contains filtered or unexported fields }
func NewMysql ¶
func NewMysql[T itf.ModelInterface]() *Mysql[T]
func NewMysqlBy ¶ added in v2.2.1
func NewMysqlBy[T itf.ModelInterface](isMaster bool) *Mysql[T]
func (*Mysql[T]) AddSharding ¶
func (*Mysql[T]) BatchInsert ¶
func (*Mysql[T]) BatchInsertCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchAllByWhere ¶
func (*Mysql[T]) FetchAllByWhereCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchAllCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchPageBySelect ¶ added in v2.0.8
func (*Mysql[T]) FetchPageBySelectCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchPageByWhere ¶
func (*Mysql[T]) FetchPageByWhereCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchPageCtx ¶ added in v2.1.0
func (*Mysql[T]) FetchRowCtx ¶ added in v2.1.0
func (*Mysql[T]) GetShardingKey ¶
func (*Mysql[T]) LockRowCtx ¶ added in v2.1.0
func (*Mysql[T]) Transaction ¶ added in v2.0.3
func (*Mysql[T]) TransactionCtx ¶ added in v2.1.0
type Tx ¶ added in v2.0.3
func NewTxBy ¶ added in v2.2.1
func NewTxBy(ctx object.CtxInterface) *Tx
func (*Tx) IsCompleted ¶ added in v2.0.3
Click to show internal directories.
Click to hide internal directories.