jgorm

package
v0.0.0-...-3f91146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColsNamesByExpr

func ColsNamesByExpr(expr ...field.Expr) []string

func DaoDbBlank

func DaoDbBlank(dao gen.Dao) *gorm.DB

获取一个空的 db,用于构建子查询

func DaoShowSQL

func DaoShowSQL(dao gen.Dao) string

获取 dao 的 sql

func DaoToSub

func DaoToSub(dao gen.Dao, alias string) gen.Dao

使用别名构建子查询

func DebugGorm

func DebugGorm()

func DefaultSimpleDay

func DefaultSimpleDay(curTime time.Time, colName, tableName string) time.Time

func SafeStr

func SafeStr(s string, size int) string

SafeStr 限定字符串长度,避免字段溢出

func Select

func Select(do *gen.DO, columns ...interface{})

Select 字段

columns: field.Expr, string, clause.Expr

func SelectAppend

func SelectAppend(do *gen.DO, columns ...interface{})

SelectAppend 增加字段

columns: field.Expr, string, clause.Expr

func SetDbLogger

func SetDbLogger(db *gorm.DB, logSql string) *gorm.DB

SetDbLogger 打开调试日志

func SetDefaultBusinessDay

func SetDefaultBusinessDay(fn BusinessDayGenFn)

SetDefaultBusinessDay 自定义业务日期生成函数

func StmtReplaceColumnValue

func StmtReplaceColumnValue(stmt *gorm.Statement, field *schema.Field, fn func(r1 interface{}, zero bool) (r2 interface{}, replace bool))

Types

type BusinessDayGenFn

type BusinessDayGenFn func(curTime time.Time, colName, tableName string) time.Time

BusinessDayGenFn 自定义日期生成函数,参数:当前时间,字段名,表名

type SimpleDayCreateClause

type SimpleDayCreateClause struct {
	Field *schema.Field
}

func (SimpleDayCreateClause) Build

func (b SimpleDayCreateClause) Build(builder clause.Builder)

func (SimpleDayCreateClause) MergeClause

func (b SimpleDayCreateClause) MergeClause(c *clause.Clause)

func (SimpleDayCreateClause) ModifyStatement

func (b SimpleDayCreateClause) ModifyStatement(stmt *gorm.Statement)

func (SimpleDayCreateClause) Name

func (b SimpleDayCreateClause) Name() string

type SimpleDayType

type SimpleDayType datatypes.Date

func (SimpleDayType) CreateClauses

func (n SimpleDayType) CreateClauses(f *schema.Field) []clause.Interface

func (*SimpleDayType) GobDecode

func (dt *SimpleDayType) GobDecode(b []byte) error

func (SimpleDayType) GobEncode

func (dt SimpleDayType) GobEncode() ([]byte, error)

func (SimpleDayType) GormDataType

func (dt SimpleDayType) GormDataType() string

GormDataType gorm common data type

func (SimpleDayType) IsValid

func (d SimpleDayType) IsValid() bool

func (SimpleDayType) MarshalJSON

func (dt SimpleDayType) MarshalJSON() ([]byte, error)

func (SimpleDayType) MarshalText

func (dt SimpleDayType) MarshalText() ([]byte, error)

func (*SimpleDayType) Scan

func (dt *SimpleDayType) Scan(value interface{}) (err error)

func (SimpleDayType) String

func (dt SimpleDayType) String() string

func (*SimpleDayType) UnmarshalJSON

func (dt *SimpleDayType) UnmarshalJSON(b []byte) error

func (*SimpleDayType) UnmarshalText

func (dt *SimpleDayType) UnmarshalText(data []byte) error

func (SimpleDayType) Value

func (dt SimpleDayType) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL