Documentation
¶
Index ¶
- func GetDB() *gorm.DB
- func ImplGetPrimaryDBFunc(impl func() *gorm.DB) (implSet bool)
- func InitSchema(rail miso.Rail, initSchemaSegments []string, getDB func() *gorm.DB) error
- func InitSchemaConditionally(rail miso.Rail, conditionalSegments []ConditionalSchemaSegment, ...) error
- func NewGormLogger(config lg.Config) *gormLogger
- func NewQueryFunc(table string, ops ...func(q *Query) *Query) func(r miso.Rail, db *gorm.DB) *Query
- type ChainedPageQuery
- type ConditionalSchemaSegment
- type IteratePageParam
- type Nilable
- type NilableValue
- type PageQuery
- func (pq *PageQuery[V]) IterateAll(rail miso.Rail, param IteratePageParam, ...) error
- func (pq *PageQuery[V]) Scan(rail miso.Rail, reqPage miso.Paging) (miso.PageRes[V], error)
- func (pq *PageQuery[V]) Transform(t util.Transform[V]) *PageQuery[V]
- func (pq *PageQuery[V]) TransformAsync(t util.TransformAsync[V]) *PageQuery[V]
- func (pq *PageQuery[V]) WithBaseQuery(qry ChainedPageQuery) *PageQuery[V]
- func (pq *PageQuery[V]) WithSelectQuery(qry ChainedPageQuery) *PageQuery[V]
- type Query
- func (q *Query) And(f func(*Query) *Query) *Query
- func (q *Query) Between(col string, args ...any) *Query
- func (q *Query) ColumnName(s string) string
- func (q *Query) CopyNew() *Query
- func (q *Query) Count() (int64, error)
- func (q *Query) Create(v any) (rowsAffected int64, err error)
- func (q *Query) CreateIgnore(v any) (rowsAffected int64, err error)
- func (q *Query) DB() *gorm.DB
- func (q *Query) Eq(col string, args ...any) *Query
- func (q *Query) EqIf(cond bool, col string, args ...any) *Query
- func (q *Query) EqNotEmpty(col string, v any) *Query
- func (q *Query) Exec(sql string, args ...any) (rowsAffected int64, err error)
- func (q *Query) From(table string) *Query
- func (q *Query) Ge(col string, args ...any) *Query
- func (q *Query) GeIf(cond bool, col string, args ...any) *Query
- func (q *Query) Group(name string) *Query
- func (q *Query) Gt(col string, args ...any) *Query
- func (q *Query) GtIf(cond bool, col string, args ...any) *Query
- func (q *Query) If(cond bool, f func(*Query) *Query) *Query
- func (q *Query) IsNotNull(col string) *Query
- func (q *Query) IsNull(col string) *Query
- func (q *Query) Join(query string, args ...any) *Query
- func (q *Query) JoinIf(addJoin bool, query string, args ...any) *Query
- func (q *Query) Joins(query string, args ...any) *Query
- func (q *Query) Le(col string, args ...any) *Query
- func (q *Query) LeIf(cond bool, col string, args ...any) *Query
- func (q *Query) Like(col string, val string) *Query
- func (q *Query) LikeIf(cond bool, col string, val string) *Query
- func (q *Query) LikeLeft(col string, val string) *Query
- func (q *Query) LikeLeftIf(cond bool, col string, val string) *Query
- func (q *Query) LikeRight(col string, val string) *Query
- func (q *Query) LikeRightIf(cond bool, col string, val string) *Query
- func (q *Query) Limit(n int) *Query
- func (q *Query) Lt(col string, args ...any) *Query
- func (q *Query) LtIf(cond bool, col string, args ...any) *Query
- func (q *Query) Ne(col string, args ...any) *Query
- func (q *Query) NeIf(cond bool, col string, args ...any) *Query
- func (q *Query) Offset(n int) *Query
- func (q *Query) Omit(col ...string) *Query
- func (q *Query) Or(query string, args ...any) *Query
- func (q *Query) OrFunc(f func(*Query) *Query) *Query
- func (q *Query) OrIf(cond bool, query string, args ...any) *Query
- func (q *Query) Order(order string) *Query
- func (q *Query) OrderAsc(col string) *Query
- func (q *Query) OrderDesc(col string) *Query
- func (q *Query) Raw(sql string, args ...any) *Query
- func (q *Query) Scan(ptr any) (rowsAffected int64, err error)
- func (q *Query) Select(cols string, args ...any) *Query
- func (q *Query) SelectCols(v any) *Query
- func (q *Query) Set(col string, arg any) *Query
- func (q *Query) SetCols(arg any, cols ...string) *Query
- func (q *Query) SetIf(cond bool, col string, arg any) *Query
- func (q *Query) Table(table string) *Query
- func (q *Query) Transaction(onTransaction func(db *gorm.DB) error) error
- func (q *Query) Update() (rowsAffected int64, err error)
- func (q *Query) Where(query string, args ...any) *Query
- func (q *Query) WhereFunc(f func(*Query) *Query) *Query
- func (q *Query) WhereIf(addWhere bool, query string, args ...any) *Query
- func (q *Query) WhereNotNil(query string, v any) *Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImplGetPrimaryDBFunc ¶ added in v0.1.18
func InitSchema ¶
func InitSchemaConditionally ¶ added in v0.1.17
func NewGormLogger ¶ added in v0.2.0
Types ¶
type ChainedPageQuery ¶
type ConditionalSchemaSegment ¶ added in v0.1.17
type IteratePageParam ¶ added in v0.1.22
type IteratePageParam struct {
Limit int `json:"limit" desc:"page limit"`
}
type NilableValue ¶
type NilableValue struct {
// contains filtered or unexported fields
}
func (*NilableValue) IsZero ¶
func (n *NilableValue) IsZero() bool
func (*NilableValue) MarkZero ¶
func (n *NilableValue) MarkZero(isZero bool)
type PageQuery ¶
type PageQuery[V any] struct { // contains filtered or unexported fields }
Create param for page query.
func (*PageQuery[V]) IterateAll ¶ added in v0.1.22
func (*PageQuery[V]) TransformAsync ¶
func (pq *PageQuery[V]) TransformAsync(t util.TransformAsync[V]) *PageQuery[V]
func (*PageQuery[V]) WithBaseQuery ¶
func (pq *PageQuery[V]) WithBaseQuery(qry ChainedPageQuery) *PageQuery[V]
func (*PageQuery[V]) WithSelectQuery ¶
func (pq *PageQuery[V]) WithSelectQuery(qry ChainedPageQuery) *PageQuery[V]
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) ColumnName ¶ added in v0.2.0
func (*Query) CreateIgnore ¶ added in v0.2.0
func (*Query) From ¶
Same as *Query.Table().
It was a mistake to call it From(), since we also use *Query to update tables :(
func (*Query) LikeLeftIf ¶
LIKE '%?'
func (*Query) LikeRightIf ¶
LIKE '?%'
func (*Query) SelectCols ¶ added in v0.2.0
func (*Query) Transaction ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.