Documentation
¶
Index ¶
- Constants
- Variables
- func EscapeLikeString(s string) string
- func FuzzySearch(s string) string
- func NewFieldMetaMapping[T CTable](ml schema.Tabler, fm T) *T
- func NewGlobalFieldMetaMapping[T CTable](ml schema.Tabler, fm T, tAs ...string) *T
- func NewLogger(cfg *LogConfig) logger.Interface
- func PrefixSearch(s string) string
- func SetDefaultDB(fn DefaultDB)
- func SuffixSearch(s string) string
- type BaseOpr
- func (b *BaseOpr) DB(ctx context.Context) *gorm.DB
- func (b *BaseOpr) Distinct(distinct ...field.Expr) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) Group(group ...field.Expr) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) Having(having ...any) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) Join(table string, field field.Expr) func(db *gorm.DB) *gorm.DB
- func (b *BaseOpr) LeftJoin(table string, field field.Expr) func(db *gorm.DB) *gorm.DB
- func (b *BaseOpr) NewDB() *gorm.DB
- func (b *BaseOpr) Opr(ctx context.Context) *BaseOpr
- func (b *BaseOpr) Or(exprs ...field.Expr) func(db *gorm.DB) *gorm.DB
- func (b *BaseOpr) Order(orders ...field.Expr) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) Page(page, pageSize int) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) RightJoin(table string, field field.Expr) func(db *gorm.DB) *gorm.DB
- func (b *BaseOpr) Select(selects ...field.Expr) func(*gorm.DB) *gorm.DB
- func (b *BaseOpr) SilentDB(ctx context.Context) *gorm.DB
- func (b *BaseOpr) Where(where ...field.Expr) func(*gorm.DB) *gorm.DB
- type CTable
- type Corm
- type DefaultDB
- type LogConfig
- type SqlTX
- type Transaction
Constants ¶
View Source
const ( InfoLevel = "info" WarnLevel = "warn" WarningLevel = "warning" ErrorLevel = "error" SilentLevel = "silent" )
View Source
const ( JoinTypeInner = "INNER" JoinTypeLeft = "LEFT" JoinTypeRight = "RIGHT" )
Variables ¶
View Source
var (
PercentSignUTF8, _ = utf8.DecodeRuneInString("%")
UnderscoreUTF8, _ = utf8.DecodeRuneInString("_")
EscapeCharUTF8, _ = utf8.DecodeRuneInString(`\`)
)
View Source
var ( DBKeyError = errors.EC_SQL_DB_KEY_ERROR DefaultDBError = errors.EC_SQL_DEFAULT_DB_ERROR )
View Source
var SilentLogger = NewLogger(&LogConfig{ Level: SilentLevel, SlowThreshold: defaultSlowThreshold, })
Functions ¶
func EscapeLikeString ¶
func FuzzySearch ¶
func NewFieldMetaMapping ¶
func PrefixSearch ¶
func SetDefaultDB ¶
func SetDefaultDB(fn DefaultDB)
func SuffixSearch ¶
Types ¶
type BaseOpr ¶
type BaseOpr struct {
// contains filtered or unexported fields
}
func NewBaseOpr ¶
type Corm ¶
type Corm interface {
Where(where ...field.Expr) func(*gorm.DB) *gorm.DB
Or(exprs ...field.Expr) func(db *gorm.DB) *gorm.DB
Select(selects ...field.Expr) func(*gorm.DB) *gorm.DB
Page(page, pageSize int) func(*gorm.DB) *gorm.DB
Order(orders ...field.Expr) func(*gorm.DB) *gorm.DB
Join(table string, field field.Expr) func(*gorm.DB) *gorm.DB
LeftJoin(table string, field field.Expr) func(*gorm.DB) *gorm.DB
RightJoin(table string, field field.Expr) func(*gorm.DB) *gorm.DB
Distinct(distinct ...field.Expr) func(*gorm.DB) *gorm.DB
Group(group ...field.Expr) func(*gorm.DB) *gorm.DB
Having(having ...any) func(*gorm.DB) *gorm.DB
}
Click to show internal directories.
Click to hide internal directories.