Documentation
¶
Index ¶
- Variables
- func Batch(ormArray ...*OrmModel) error
- func BatchArray(ormArray []*OrmModel) error
- func BatchFunc(f func(tx *sqlx.Tx)) error
- func BindDB(DB *sqlx.DB) error
- func ConvertArray[T int | string](array []T) []string
- func ExecRawSQL(sql string, args ...any) error
- func JsonbBuildObjString(obj interface{}, prefix ...string) string
- func NamedExec(sqlStr string, params map[string]interface{}) error
- func NamedQuery(query string, params any, dest any) error
- func NamedQueryWithMap(query string, fieldMap map[string]any, dest any) error
- func Query(query string, dest any) error
- func StructToMap(item interface{}) (map[string]any, map[string]string)
- func UnmarshalGetPath(json []byte, val interface{}, path ...interface{}) error
- func ValueTypeToStr(v any) string
- type CRUDInterface
- type ConditionGroup
- func And(tag ...string) ConditionGroup
- func And2F(tag string, arg any) ConditionGroup
- func AndZero(tag ...string) ConditionGroup
- func Asc(tag string) ConditionGroup
- func AutoFill(zero ...bool) ConditionGroup
- func Desc(tag string) ConditionGroup
- func Eq(tag string, args ...any) ConditionGroup
- func Exp(express string, args ...any) ConditionGroup
- func Gt(tag string, args ...any) ConditionGroup
- func Gte(tag string, args ...any) ConditionGroup
- func IN[T int | string](tag string, args ...T) ConditionGroup
- func IsNull(tag ...string) ConditionGroup
- func IsNullOR(tag ...string) ConditionGroup
- func Like(tag ...string) ConditionGroup
- func LikeOR(tag ...string) ConditionGroup
- func Lt(tag string, args ...any) ConditionGroup
- func Lte(tag string, args ...any) ConditionGroup
- func Or(tag ...string) ConditionGroup
- func Or2F(tag string, args ...any) ConditionGroup
- func OrZero(tag ...string) ConditionGroup
- type ConditionType
- type ORMInterface
- type OrmModel
- func (o *OrmModel) Asc(jsonTag ...string) *OrmModel
- func (o *OrmModel) Count(column string) (int64, error)
- func (o *OrmModel) Delete(i interface{}) *OrmModel
- func (o *OrmModel) Desc(jsonTag ...string) *OrmModel
- func (o *OrmModel) EmptyKey(f bool) *OrmModel
- func (o *OrmModel) Error() error
- func (o *OrmModel) ExcludeFields(jsonTag ...string) *OrmModel
- func (o *OrmModel) Exec() error
- func (o *OrmModel) Fields(jsonTag ...string) *OrmModel
- func (o *OrmModel) FullSQL() (string, map[string]interface{})
- func (o *OrmModel) If(ifFunc func(o *OrmModel)) *OrmModel
- func (o *OrmModel) Insert(i interface{}) *OrmModel
- func (o *OrmModel) JsonbList(dest interface{}) error
- func (o *OrmModel) JsonbListString() (string, error)
- func (o *OrmModel) JsonbMap(dest interface{}, columns ...string) error
- func (o *OrmModel) JsonbMapString(keys ...string) (string, error)
- func (o *OrmModel) Limit(row int64) *OrmModel
- func (o *OrmModel) Log(l bool) *OrmModel
- func (o *OrmModel) Many(dest interface{}) error
- func (o *OrmModel) NamedSQL() (string, map[string]interface{})
- func (o *OrmModel) Offset(row int64) *OrmModel
- func (o *OrmModel) One(dest interface{}) error
- func (o *OrmModel) RETURNING(single any, list any, jsonTag ...string) error
- func (o *OrmModel) Select(i interface{}) *OrmModel
- func (o *OrmModel) SetField(jsonTag string, arg any) *OrmModel
- func (o *OrmModel) Update(i interface{}) *OrmModel
- func (o *OrmModel) Where(cgs ...ConditionGroup) *OrmModel
- func (o *OrmModel) WherePK() *OrmModel
- func (o *OrmModel) With(t string) *OrmModel
- func (o *OrmModel) WithAsc(fields ...string) *OrmModel
- func (o *OrmModel) WithDesc(fields ...string) *OrmModel
- type PageResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SqlxDB *sqlx.DB TagName = "db" )
Functions ¶
func BatchArray ¶
func ConvertArray ¶ added in v0.1.6
func ExecRawSQL ¶ added in v0.2.0
func JsonbBuildObjString ¶ added in v0.2.8
func NamedQueryWithMap ¶ added in v0.3.1
func UnmarshalGetPath ¶
func ValueTypeToStr ¶ added in v0.3.3
Types ¶
type CRUDInterface ¶
type ConditionGroup ¶
type ConditionGroup struct {
Logic string
Symbol string
JsonTags []string
Args []any
InArgs []string
NamedExpress string // named 表达式
// contains filtered or unexported fields
}
func And ¶
func And(tag ...string) ConditionGroup
func And2F ¶
func And2F(tag string, arg any) ConditionGroup
func AndZero ¶ added in v0.3.3
func AndZero(tag ...string) ConditionGroup
func Asc ¶ added in v0.3.1
func Asc(tag string) ConditionGroup
func AutoFill ¶ added in v0.3.3
func AutoFill(zero ...bool) ConditionGroup
func Desc ¶ added in v0.3.1
func Desc(tag string) ConditionGroup
func Eq ¶ added in v0.3.3
func Eq(tag string, args ...any) ConditionGroup
func Exp ¶
func Exp(express string, args ...any) ConditionGroup
Exp 条件表达式 {table_column_field}=:{name}
func Gt ¶ added in v0.3.3
func Gt(tag string, args ...any) ConditionGroup
func Gte ¶ added in v0.3.3
func Gte(tag string, args ...any) ConditionGroup
func Like ¶ added in v0.3.1
func Like(tag ...string) ConditionGroup
func LikeOR ¶ added in v0.3.3
func LikeOR(tag ...string) ConditionGroup
func Lt ¶ added in v0.3.3
func Lt(tag string, args ...any) ConditionGroup
func Lte ¶ added in v0.3.3
func Lte(tag string, args ...any) ConditionGroup
func Or ¶
func Or(tag ...string) ConditionGroup
func Or2F ¶
func Or2F(tag string, args ...any) ConditionGroup
func OrZero ¶ added in v0.3.3
func OrZero(tag ...string) ConditionGroup
func (ConditionGroup) Transform ¶
func (cg ConditionGroup) Transform() string
type ConditionType ¶ added in v0.3.1
type ConditionType int
type ORMInterface ¶
type ORMInterface interface {
TableName() string
}
type OrmModel ¶
type OrmModel struct {
// contains filtered or unexported fields
}
func DELETE ¶
func DELETE(i ORMInterface) *OrmModel
func INSERT ¶
func INSERT(i ORMInterface) *OrmModel
func RawNamedSQL ¶ added in v0.1.18
func SELECT ¶
func SELECT(i ORMInterface) *OrmModel
func UPDATE ¶
func UPDATE(i ORMInterface) *OrmModel
func (*OrmModel) ExcludeFields ¶ added in v0.1.17
func (*OrmModel) JsonbListString ¶
func (*OrmModel) Where ¶
func (o *OrmModel) Where(cgs ...ConditionGroup) *OrmModel
type PageResult ¶ added in v0.3.1
type PageResult[T any] struct { Total int `json:"total" db:"total"` //总记录数 TotalPage int `json:"totalPage" db:"total_page"` //总页数 Page int `json:"page" db:"page"` //当前页 PageSize int `json:"pageSize" db:"page_size"` //页面数量 List []T `json:"list" db:"list"` //分页数据 }
func DebugPAGE ¶ added in v0.3.3
func DebugPAGE[T ORMInterface](entity T, debug bool, page, pageSize int, cgs ...ConditionGroup) (PageResult[T], error)
func PAGE ¶ added in v0.3.1
func PAGE[T ORMInterface](entity T, page, pageSize int, cgs ...ConditionGroup) (PageResult[T], error)
func (PageResult[T]) CalcTotalPage ¶ added in v0.3.1
func (pr PageResult[T]) CalcTotalPage() int
Click to show internal directories.
Click to hide internal directories.