Documentation ¶
Index ¶
- Variables
- type ArgsAddress
- type ArgsConfig
- type ArgsConfigList
- type ArgsGPS
- type ArgsID
- type ArgsPages
- type ArgsTimeBetween
- type Client
- func (t *Client) Analysis() *ClientAnalysisCtx
- func (t *Client) Delete() *ClientDeleteCtx
- func (t *Client) Get() *ClientGetCtx
- func (t *Client) GetFields() []string
- func (t *Client) GetKey() string
- func (t *Client) GetSortNameByJsonStruct(paramSort string, structData any, defaultSort string) (result string)
- func (t *Client) Init(mainDB *SQLClient, tableName string) *Client
- func (t *Client) Init2(mainDB *SQLClient, tableName string, structData any) (client *Client, err error)
- func (t *Client) Insert() *ClientInsertCtx
- func (t *Client) InstallSQL() (err error)
- func (t *Client) Select() *ClientListCtx
- func (t *Client) SetCache(obj *CoreCache.CacheData) *Client
- func (t *Client) SetCreateLock(b bool) *Client
- func (t *Client) SetDeleteLock(b bool) *Client
- func (t *Client) SetEditLock(b bool) *Client
- func (t *Client) SetExpireSec(sec int) *Client
- func (t *Client) SetKey(key string) *Client
- func (t *Client) SetUpdateLock(b bool) *Client
- func (t *Client) SetViewLock(b bool) *Client
- func (t *Client) Update() *ClientUpdateCtx
- type ClientAnalysisCountFieldCtx
- type ClientAnalysisCtx
- func (t *ClientAnalysisCtx) AVG(where string, args ...any) (val float64)
- func (t *ClientAnalysisCtx) Count(where string, args ...any) (val int64)
- func (t *ClientAnalysisCtx) DataNoDelete() *ClientAnalysisCtx
- func (t *ClientAnalysisCtx) GetError() error
- func (t *ClientAnalysisCtx) Max(where string, args ...any) (val int64)
- func (t *ClientAnalysisCtx) Min(where string, args ...any) (val int64)
- func (t *ClientAnalysisCtx) Sum(data any, fields []string, where string, args ...any) (err error)
- func (t *ClientAnalysisCtx) Sum2(where string, args ...any) (val int64)
- func (t *ClientAnalysisCtx) Sum2ByFloat64(where string, args ...any) (val float64)
- type ClientCtx
- func (t *ClientCtx) DataNoDelete() *ClientCtx
- func (t *ClientCtx) Exec(query string, args ...any) (sql.Result, error)
- func (t *ClientCtx) Get(dest interface{}, query string, args ...interface{}) error
- func (t *ClientCtx) GetFields(l []string) string
- func (t *ClientCtx) GetQuery() string
- func (t *ClientCtx) MustBegin() *sqlx.Tx
- func (t *ClientCtx) NamedExec(query string, arg interface{}) (sql.Result, error)
- func (t *ClientCtx) Ping() error
- func (t *ClientCtx) PrepareNamed(query string) (*sqlx.NamedStmt, error)
- func (t *ClientCtx) Select(dest interface{}, query string, args ...interface{}) error
- type ClientDeleteCtx
- func (t *ClientDeleteCtx) AddQuery(fieldName string, param any) *ClientDeleteCtx
- func (t *ClientDeleteCtx) AddWhereID(id int64) *ClientDeleteCtx
- func (t *ClientDeleteCtx) AddWhereOrgID(orgID int64) *ClientDeleteCtx
- func (t *ClientDeleteCtx) AddWhereUserID(userID int64) *ClientDeleteCtx
- func (t *ClientDeleteCtx) ClearAll() error
- func (t *ClientDeleteCtx) Exec(where string, args ...any) error
- func (t *ClientDeleteCtx) ExecAny(arg interface{}) error
- func (t *ClientDeleteCtx) ExecNamed(arg map[string]interface{}) error
- func (t *ClientDeleteCtx) NeedSoft(b bool) *ClientDeleteCtx
- func (t *ClientDeleteCtx) SetWhereAnd(name string, val interface{}) *ClientDeleteCtx
- func (t *ClientDeleteCtx) SetWhereOrThan(name string, val interface{}) *ClientDeleteCtx
- func (t *ClientDeleteCtx) SetWhereStr(where string, arg map[string]interface{}) *ClientDeleteCtx
- type ClientGetCtx
- func (t *ClientGetCtx) AddQuery(field string) *ClientGetCtx
- func (t *ClientGetCtx) AddQueryAndParam(field string, param any) *ClientGetCtx
- func (t *ClientGetCtx) AppendWhere(where string, args ...interface{}) *ClientGetCtx
- func (t *ClientGetCtx) GetByCodeAndOrgID(code string, orgID int64) *ClientGetCtx
- func (t *ClientGetCtx) GetByID(id int64) *ClientGetCtx
- func (t *ClientGetCtx) GetByIDAndOrgID(id int64, orgID int64) *ClientGetCtx
- func (t *ClientGetCtx) GetByIDAndUserID(id int64, userID int64) *ClientGetCtx
- func (t *ClientGetCtx) GetByMarkAndOrgID(mark string, orgID int64) *ClientGetCtx
- func (t *ClientGetCtx) NeedLimit() *ClientGetCtx
- func (t *ClientGetCtx) NeedSort(needSort bool, sortField string, sortIsDesc bool) *ClientGetCtx
- func (t *ClientGetCtx) Result(data interface{}) error
- func (t *ClientGetCtx) SetBoolQuery(field string, param bool) *ClientGetCtx
- func (t *ClientGetCtx) SetDefaultFields() *ClientGetCtx
- func (t *ClientGetCtx) SetDefaultListFields() *ClientGetCtx
- func (t *ClientGetCtx) SetDeleteQuery(field string, param bool) *ClientGetCtx
- func (t *ClientGetCtx) SetFieldsOne(fields []string) *ClientGetCtx
- func (t *ClientGetCtx) SetIDQuery(field string, param int64) *ClientGetCtx
- func (t *ClientGetCtx) SetInt64Query(field string, param int64) *ClientGetCtx
- func (t *ClientGetCtx) SetIntQuery(field string, param int) *ClientGetCtx
- func (t *ClientGetCtx) SetStringQuery(field string, param string) *ClientGetCtx
- func (t *ClientGetCtx) SetTimeMaxQuery(field string, maxAt time.Time) *ClientGetCtx
- func (t *ClientGetCtx) SetTimeMinQuery(field string, minAt time.Time) *ClientGetCtx
- type ClientInsertCtx
- func (t *ClientInsertCtx) Add(args interface{}) *ClientInsertCtx
- func (t *ClientInsertCtx) Exec() error
- func (t *ClientInsertCtx) ExecAndCheckID() error
- func (t *ClientInsertCtx) ExecAndResultData(data interface{}) error
- func (t *ClientInsertCtx) ExecAndResultID() (int64, error)
- func (t *ClientInsertCtx) SetDefaultFields() *ClientInsertCtx
- func (t *ClientInsertCtx) SetDefaultInsertFields() *ClientInsertCtx
- func (t *ClientInsertCtx) SetFields(fields []string) *ClientInsertCtx
- type ClientListCtx
- func (t *ClientListCtx) AddQuery(field string) *ClientListCtx
- func (t *ClientListCtx) AddQueryAndParam(field string, param any) *ClientListCtx
- func (t *ClientListCtx) GetLastQuery() string
- func (t *ClientListCtx) Result(data interface{}) error
- func (t *ClientListCtx) ResultAndCount(data interface{}) (count int64, err error)
- func (t *ClientListCtx) ResultCount() (count int64, err error)
- func (t *ClientListCtx) SelectList(where string, args ...interface{}) *ClientListCtx
- func (t *ClientListCtx) SetBoolAndNeedQuery(field string, needParam, param bool) *ClientListCtx
- func (t *ClientListCtx) SetBoolQuery(field string, param bool) *ClientListCtx
- func (t *ClientListCtx) SetDefaultIndexFields() *ClientListCtx
- func (t *ClientListCtx) SetDefaultKeyListFields() *ClientListCtx
- func (t *ClientListCtx) SetDefaultListFields() *ClientListCtx
- func (t *ClientListCtx) SetDeleteQuery(field string, param bool) *ClientListCtx
- func (t *ClientListCtx) SetFieldsAll() *ClientListCtx
- func (t *ClientListCtx) SetFieldsList(fields []string) *ClientListCtx
- func (t *ClientListCtx) SetFieldsSort(fields []string) *ClientListCtx
- func (t *ClientListCtx) SetFieldsSortDefault() *ClientListCtx
- func (t *ClientListCtx) SetFloat(field string, param float64) *ClientListCtx
- func (t *ClientListCtx) SetIDNoQuery(field string, param int64) *ClientListCtx
- func (t *ClientListCtx) SetIDQuery(field string, param int64) *ClientListCtx
- func (t *ClientListCtx) SetIDThanLessQuery(field string, param int64) *ClientListCtx
- func (t *ClientListCtx) SetIDsAndMoreQuery(field string, param pq.Int64Array) *ClientListCtx
- func (t *ClientListCtx) SetIDsMixMoreQuery(field string, isOr bool, param pq.Int64Array) *ClientListCtx
- func (t *ClientListCtx) SetIDsOrMoreQuery(field string, param pq.Int64Array) *ClientListCtx
- func (t *ClientListCtx) SetIDsQuery(field string, param pq.Int64Array) *ClientListCtx
- func (t *ClientListCtx) SetInt64BetweenQuery(field string, minParam int64, maxParam int64) *ClientListCtx
- func (t *ClientListCtx) SetIntNoQuery(field string, param int) *ClientListCtx
- func (t *ClientListCtx) SetIntQuery(field string, param int) *ClientListCtx
- func (t *ClientListCtx) SetPages(pages ArgsPages) *ClientListCtx
- func (t *ClientListCtx) SetSearchQuery(fields []string, search string) *ClientListCtx
- func (t *ClientListCtx) SetStringNoNullQuery(field string) *ClientListCtx
- func (t *ClientListCtx) SetStringQuery(field string, param string) *ClientListCtx
- func (t *ClientListCtx) SetTimeBetweenByArgQuery(field string, betweenAt ArgsTimeBetween) *ClientListCtx
- func (t *ClientListCtx) SetTimeBetweenQuery(field string, startAt time.Time, endAt time.Time) *ClientListCtx
- func (t *ClientListCtx) SetTimeExistQuery(field string, needParam bool, param bool) *ClientListCtx
- type ClientUpdateCtx
- func (t *ClientUpdateCtx) AddWhereID(id int64) *ClientUpdateCtx
- func (t *ClientUpdateCtx) AddWhereOrgID(orgID int64) *ClientUpdateCtx
- func (t *ClientUpdateCtx) AddWhereUserID(userID int64) *ClientUpdateCtx
- func (t *ClientUpdateCtx) GetLastQuery() string
- func (t *ClientUpdateCtx) NamedExec(arg map[string]interface{}) error
- func (t *ClientUpdateCtx) NeedSoft(b bool) *ClientUpdateCtx
- func (t *ClientUpdateCtx) NeedUpdateTime() *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetDefaultFields() *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetFieldStr(fields string) *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetFields(fields []string) *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetWhereAnd(name string, val interface{}) *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetWhereOrThan(name string, val interface{}) *ClientUpdateCtx
- func (t *ClientUpdateCtx) SetWhereStr(where string, arg map[string]interface{}) *ClientUpdateCtx
- type FieldsAddress
- type FieldsConfig
- type FieldsConfigList
- func (t FieldsConfigList) CheckVal(mark string, val string) (nowVal string, b bool)
- func (t FieldsConfigList) GetVal(mark string) (val string, b bool)
- func (t FieldsConfigList) GetValBool(mark string) (val bool, b bool)
- func (t FieldsConfigList) GetValFloat64(mark string) (val float64, b bool)
- func (t FieldsConfigList) GetValInt(mark string) (val int, b bool)
- func (t FieldsConfigList) GetValInt64(mark string) (val int64, b bool)
- func (t FieldsConfigList) GetValInt64NoBool(mark string) (val int64)
- func (t FieldsConfigList) GetValNoBool(mark string) (val string)
- func (t FieldsConfigList) GetValNoErr(mark string) (val string)
- func (t *FieldsConfigList) Scan(value interface{}) error
- func (t FieldsConfigList) Value() (driver.Value, error)
- type FieldsGPS
- type FieldsTimeBetween
- type SQLClient
- type WaitLogType
Constants ¶
This section is empty.
Variables ¶
var ( //WaitLog 为减少和外部模块的侵入性,此设计将记录一些必要的元素内容,外部抽取后释放即可 // 等待处理的请求记录 WaitLog []WaitLogType WaitLogLock sync.Mutex )
var ( //OpenDebug debug OpenDebug = false )
Functions ¶
This section is empty.
Types ¶
type ArgsAddress ¶
type ArgsAddress struct { //所属国家 国家代码 // eg: china => 86 Country int `db:"country" json:"country" check:"country" empty:"true"` //省份 编码 // eg: 710000 Province int `db:"province" json:"province"` //所属城市 City int `db:"city" json:"city" check:"city" empty:"true"` //街道详细信息 Address string `db:"address" json:"address"` //地图制式 // 0 WGS-84 / 1 GCJ-02 / 2 BD-09 MapType int `db:"map_type" json:"mapType"` //坐标位置 Longitude float64 `db:"longitude" json:"longitude"` Latitude float64 `db:"latitude" json:"latitude"` //联系人姓名 Name string `db:"name" json:"name"` //联系人国家代码 NationCode string `db:"nation_code" json:"nationCode"` //联系人手机号 Phone string `db:"phone" json:"phone"` }
func (*ArgsAddress) GetField ¶
func (t *ArgsAddress) GetField() FieldsAddress
type ArgsConfig ¶
type ArgsConfig struct { //标识码 Mark string `db:"mark" json:"mark" check:"mark" empty:"true"` //值 Val string `db:"val" json:"val"` }
ArgsConfig 扩展结构
func (*ArgsConfig) GetField ¶
func (t *ArgsConfig) GetField() FieldsConfig
type ArgsConfigList ¶
type ArgsConfigList []ArgsConfig
func (ArgsConfigList) GetFields ¶
func (t ArgsConfigList) GetFields() FieldsConfigList
type ArgsGPS ¶
type ArgsPages ¶
type ArgsPages struct { Page int64 `json:"page" check:"page"` Max int64 `json:"max" check:"max"` Sort string `json:"sort" check:"sort"` Desc bool `json:"desc" check:"desc"` }
ArgsPages 分页结构体
type ArgsTimeBetween ¶
type ArgsTimeBetween struct { //最小时间 // Default时间 MinTime string `json:"minTime" check:"defaultTime"` //最大时间 // Default时间 MaxTime string `json:"maxTime" check:"defaultTime"` }
func (*ArgsTimeBetween) GetFields ¶
func (t *ArgsTimeBetween) GetFields() (FieldsTimeBetween, error)
type Client ¶
type Client struct { //sql操作核心 DB *SQLClient //表名称 TableName string //空结构体 // *args 注意采用引用关系,否则无法获取到结构体的类型 StructData any //关键索引 Key string //是否关闭自动安装 CloseAutoInstall bool // contains filtered or unexported fields }
Client 操作表核心 具体的表定义对象即可使用
func (*Client) Analysis ¶
func (t *Client) Analysis() *ClientAnalysisCtx
func (*Client) Delete ¶
func (t *Client) Delete() *ClientDeleteCtx
func (*Client) Get ¶
func (t *Client) Get() *ClientGetCtx
func (*Client) GetSortNameByJsonStruct ¶ added in v5.1.39
func (t *Client) GetSortNameByJsonStruct(paramSort string, structData any, defaultSort string) (result string)
GetSortNameByJsonStruct 通过json/db结构体获取排序字段
func (*Client) Insert ¶
func (t *Client) Insert() *ClientInsertCtx
func (*Client) InstallSQL ¶ added in v5.1.39
InstallSQL SQL自动安装工具 * dataDefault 初始化需采用的空数据集 1. 如果给予值,则代表有默认值,将按照默认值构建数据表 2. eg: dataDefault = data = ClassSort.FieldsSort{} 3. 如果已经创建过的表,会自动补全数据;但注意,旧的字段需手动变更调整!补增字段,不支持id。
识别规则(tag) : db: 数据库字段名 index=true: 是否建立索引,用于提高检索效率 unique=true: 是否全局唯一
值类型: 数据库字段类型 max="1/-1": 最大长度,数字或者*代表最大长度,如果给予-1,则例如string按照text处理 index_out="tableName:field_name": 外键索引 default="any/now()": 默认值,sql直接写入;预设值不支持。
值类型转化对应关系: int: integer []int: integer[] pq.Int32Array: integer[] int64: bigint []int64: bigint[] pq.Int64Array: bigint[] bool: boolean time.Time: timestamp string: varchar(max), 如果没有给予max,将按照255长度 string: text
预设值规则(tag) : id: 主键,和unique=true一样 createAt: 创建时间 updateAt: 更新时间 deleteAt: 删除时间 code: 编码 mark: 标识码 comment: 评价
func (*Client) Select ¶
func (t *Client) Select() *ClientListCtx
func (*Client) SetCreateLock ¶
func (*Client) SetDeleteLock ¶
func (*Client) SetEditLock ¶
func (*Client) SetExpireSec ¶
func (*Client) SetUpdateLock ¶
func (*Client) SetViewLock ¶
func (*Client) Update ¶
func (t *Client) Update() *ClientUpdateCtx
type ClientAnalysisCtx ¶
type ClientAnalysisCtx struct {
// contains filtered or unexported fields
}
ClientAnalysisCtx 排名处理器
func (*ClientAnalysisCtx) AVG ¶
func (t *ClientAnalysisCtx) AVG(where string, args ...any) (val float64)
func (*ClientAnalysisCtx) Count ¶
func (t *ClientAnalysisCtx) Count(where string, args ...any) (val int64)
Count 计算总数 eg: where = "config = $1", args = "[config_id]"...
func (*ClientAnalysisCtx) DataNoDelete ¶
func (t *ClientAnalysisCtx) DataNoDelete() *ClientAnalysisCtx
DataNoDelete SQL结构体不含删除标记
func (*ClientAnalysisCtx) GetError ¶ added in v5.1.38
func (t *ClientAnalysisCtx) GetError() error
GetError 获取最后的错误信息
func (*ClientAnalysisCtx) Max ¶
func (t *ClientAnalysisCtx) Max(where string, args ...any) (val int64)
func (*ClientAnalysisCtx) Min ¶
func (t *ClientAnalysisCtx) Min(where string, args ...any) (val int64)
func (*ClientAnalysisCtx) Sum2 ¶
func (t *ClientAnalysisCtx) Sum2(where string, args ...any) (val int64)
func (*ClientAnalysisCtx) Sum2ByFloat64 ¶ added in v5.1.37
func (t *ClientAnalysisCtx) Sum2ByFloat64(where string, args ...any) (val float64)
type ClientCtx ¶
type ClientCtx struct {
// contains filtered or unexported fields
}
func (*ClientCtx) DataNoDelete ¶
func (*ClientCtx) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
Exec uses context.Background internally; to specify the context, use ExecContext.
func (*ClientCtx) Get ¶
Get using this DB. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.
func (*ClientCtx) MustBegin ¶
MustBegin starts a transaction, and panics on error. Returns an *sqlx.Tx instead of an *sql.Tx.
func (*ClientCtx) NamedExec ¶
NamedExec using this DB. Any named placeholder parameters are replaced with fields from arg.
func (*ClientCtx) Ping ¶
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
Ping uses context.Background internally; to specify the context, use PingContext.
func (*ClientCtx) PrepareNamed ¶
PrepareNamed returns an sqlx.NamedStmt
type ClientDeleteCtx ¶
type ClientDeleteCtx struct {
// contains filtered or unexported fields
}
func (*ClientDeleteCtx) AddQuery ¶ added in v5.2.17
func (t *ClientDeleteCtx) AddQuery(fieldName string, param any) *ClientDeleteCtx
func (*ClientDeleteCtx) AddWhereID ¶
func (t *ClientDeleteCtx) AddWhereID(id int64) *ClientDeleteCtx
AddWhereID 添加ID条件
func (*ClientDeleteCtx) AddWhereOrgID ¶
func (t *ClientDeleteCtx) AddWhereOrgID(orgID int64) *ClientDeleteCtx
AddWhereOrgID 添加组织ID条件
func (*ClientDeleteCtx) AddWhereUserID ¶
func (t *ClientDeleteCtx) AddWhereUserID(userID int64) *ClientDeleteCtx
AddWhereUserID 添加用户ID条件
func (*ClientDeleteCtx) ClearAll ¶ added in v5.1.37
func (t *ClientDeleteCtx) ClearAll() error
ClearAll 清理表
func (*ClientDeleteCtx) Exec ¶
func (t *ClientDeleteCtx) Exec(where string, args ...any) error
Exec 执行删除
func (*ClientDeleteCtx) ExecAny ¶
func (t *ClientDeleteCtx) ExecAny(arg interface{}) error
ExecAny 执行删除
func (*ClientDeleteCtx) ExecNamed ¶
func (t *ClientDeleteCtx) ExecNamed(arg map[string]interface{}) error
ExecNamed 执行删除 需要给与map[string]interface{}的参数 如果没有,则可以给与nil,程序会自动跳过
func (*ClientDeleteCtx) NeedSoft ¶
func (t *ClientDeleteCtx) NeedSoft(b bool) *ClientDeleteCtx
NeedSoft 是否软删除
func (*ClientDeleteCtx) SetWhereAnd ¶
func (t *ClientDeleteCtx) SetWhereAnd(name string, val interface{}) *ClientDeleteCtx
SetWhereAnd 添加等于关系判断
func (*ClientDeleteCtx) SetWhereOrThan ¶
func (t *ClientDeleteCtx) SetWhereOrThan(name string, val interface{}) *ClientDeleteCtx
SetWhereOrThan 设置条件或查询关系 可用于负数跳过、0以上等于的判断机制
func (*ClientDeleteCtx) SetWhereStr ¶
func (t *ClientDeleteCtx) SetWhereStr(where string, arg map[string]interface{}) *ClientDeleteCtx
SetWhereStr 追加覆盖条件部分
type ClientGetCtx ¶
type ClientGetCtx struct {
// contains filtered or unexported fields
}
func (*ClientGetCtx) AddQuery ¶ added in v5.2.17
func (t *ClientGetCtx) AddQuery(field string) *ClientGetCtx
func (*ClientGetCtx) AddQueryAndParam ¶ added in v5.2.18
func (t *ClientGetCtx) AddQueryAndParam(field string, param any) *ClientGetCtx
func (*ClientGetCtx) AppendWhere ¶
func (t *ClientGetCtx) AppendWhere(where string, args ...interface{}) *ClientGetCtx
AppendWhere 直接覆盖where
func (*ClientGetCtx) GetByCodeAndOrgID ¶
func (t *ClientGetCtx) GetByCodeAndOrgID(code string, orgID int64) *ClientGetCtx
func (*ClientGetCtx) GetByID ¶
func (t *ClientGetCtx) GetByID(id int64) *ClientGetCtx
func (*ClientGetCtx) GetByIDAndOrgID ¶
func (t *ClientGetCtx) GetByIDAndOrgID(id int64, orgID int64) *ClientGetCtx
func (*ClientGetCtx) GetByIDAndUserID ¶
func (t *ClientGetCtx) GetByIDAndUserID(id int64, userID int64) *ClientGetCtx
func (*ClientGetCtx) GetByMarkAndOrgID ¶
func (t *ClientGetCtx) GetByMarkAndOrgID(mark string, orgID int64) *ClientGetCtx
func (*ClientGetCtx) NeedLimit ¶
func (t *ClientGetCtx) NeedLimit() *ClientGetCtx
NeedLimit 限制避免条件过于宽松,造成获取多条数据的异常问题
func (*ClientGetCtx) NeedSort ¶
func (t *ClientGetCtx) NeedSort(needSort bool, sortField string, sortIsDesc bool) *ClientGetCtx
NeedSort 启动排序,用于反馈仅有数据时,获得最新或最早一条数据的设计
func (*ClientGetCtx) Result ¶
func (t *ClientGetCtx) Result(data interface{}) error
func (*ClientGetCtx) SetBoolQuery ¶ added in v5.2.37
func (t *ClientGetCtx) SetBoolQuery(field string, param bool) *ClientGetCtx
func (*ClientGetCtx) SetDefaultFields ¶ added in v5.1.39
func (t *ClientGetCtx) SetDefaultFields() *ClientGetCtx
func (*ClientGetCtx) SetDefaultListFields ¶ added in v5.1.39
func (t *ClientGetCtx) SetDefaultListFields() *ClientGetCtx
func (*ClientGetCtx) SetDeleteQuery ¶ added in v5.1.24
func (t *ClientGetCtx) SetDeleteQuery(field string, param bool) *ClientGetCtx
SetDeleteQuery 设置删除查询 如果启动此设定,请注意基于查询条件的$顺序,叠加后使用,否则讲造成条件和参数不匹配
func (*ClientGetCtx) SetFieldsOne ¶
func (t *ClientGetCtx) SetFieldsOne(fields []string) *ClientGetCtx
func (*ClientGetCtx) SetIDQuery ¶ added in v5.1.24
func (t *ClientGetCtx) SetIDQuery(field string, param int64) *ClientGetCtx
func (*ClientGetCtx) SetInt64Query ¶ added in v5.1.37
func (t *ClientGetCtx) SetInt64Query(field string, param int64) *ClientGetCtx
func (*ClientGetCtx) SetIntQuery ¶ added in v5.1.37
func (t *ClientGetCtx) SetIntQuery(field string, param int) *ClientGetCtx
func (*ClientGetCtx) SetStringQuery ¶ added in v5.1.24
func (t *ClientGetCtx) SetStringQuery(field string, param string) *ClientGetCtx
func (*ClientGetCtx) SetTimeMaxQuery ¶ added in v5.2.34
func (t *ClientGetCtx) SetTimeMaxQuery(field string, maxAt time.Time) *ClientGetCtx
SetTimeMaxQuery 小于等于某个时间
func (*ClientGetCtx) SetTimeMinQuery ¶ added in v5.2.34
func (t *ClientGetCtx) SetTimeMinQuery(field string, minAt time.Time) *ClientGetCtx
SetTimeMinQuery 大于等于某个时间
type ClientInsertCtx ¶
type ClientInsertCtx struct {
// contains filtered or unexported fields
}
func (*ClientInsertCtx) Add ¶
func (t *ClientInsertCtx) Add(args interface{}) *ClientInsertCtx
func (*ClientInsertCtx) Exec ¶
func (t *ClientInsertCtx) Exec() error
Exec 执行 TODO: 核对代码存在问题,参数没有正确写入
func (*ClientInsertCtx) ExecAndCheckID ¶
func (t *ClientInsertCtx) ExecAndCheckID() error
func (*ClientInsertCtx) ExecAndResultData ¶
func (t *ClientInsertCtx) ExecAndResultData(data interface{}) error
ExecAndResultData 执行并返回数据 TODO: 部分场景下正常写入,但反馈失败信息
func (*ClientInsertCtx) ExecAndResultID ¶
func (t *ClientInsertCtx) ExecAndResultID() (int64, error)
func (*ClientInsertCtx) SetDefaultFields ¶ added in v5.1.39
func (t *ClientInsertCtx) SetDefaultFields() *ClientInsertCtx
func (*ClientInsertCtx) SetDefaultInsertFields ¶ added in v5.1.39
func (t *ClientInsertCtx) SetDefaultInsertFields() *ClientInsertCtx
func (*ClientInsertCtx) SetFields ¶
func (t *ClientInsertCtx) SetFields(fields []string) *ClientInsertCtx
type ClientListCtx ¶
type ClientListCtx struct {
// contains filtered or unexported fields
}
func (*ClientListCtx) AddQuery ¶ added in v5.2.17
func (t *ClientListCtx) AddQuery(field string) *ClientListCtx
func (*ClientListCtx) AddQueryAndParam ¶ added in v5.2.18
func (t *ClientListCtx) AddQueryAndParam(field string, param any) *ClientListCtx
func (*ClientListCtx) GetLastQuery ¶ added in v5.1.39
func (t *ClientListCtx) GetLastQuery() string
func (*ClientListCtx) Result ¶
func (t *ClientListCtx) Result(data interface{}) error
func (*ClientListCtx) ResultAndCount ¶
func (t *ClientListCtx) ResultAndCount(data interface{}) (count int64, err error)
func (*ClientListCtx) ResultCount ¶ added in v5.1.2
func (t *ClientListCtx) ResultCount() (count int64, err error)
func (*ClientListCtx) SelectList ¶
func (t *ClientListCtx) SelectList(where string, args ...interface{}) *ClientListCtx
SelectList 如果启用了自动组合方法,请尽可能不要使用本方法where和args,否则请在where条件中明确一共注入了几个参数,并从对应参数为起点计算,避免$x顺序不匹配
func (*ClientListCtx) SetBoolAndNeedQuery ¶ added in v5.1.39
func (t *ClientListCtx) SetBoolAndNeedQuery(field string, needParam, param bool) *ClientListCtx
func (*ClientListCtx) SetBoolQuery ¶ added in v5.1.36
func (t *ClientListCtx) SetBoolQuery(field string, param bool) *ClientListCtx
SetBoolQuery Bool判断查询
func (*ClientListCtx) SetDefaultIndexFields ¶ added in v5.1.39
func (t *ClientListCtx) SetDefaultIndexFields() *ClientListCtx
func (*ClientListCtx) SetDefaultKeyListFields ¶ added in v5.1.39
func (t *ClientListCtx) SetDefaultKeyListFields() *ClientListCtx
func (*ClientListCtx) SetDefaultListFields ¶ added in v5.1.39
func (t *ClientListCtx) SetDefaultListFields() *ClientListCtx
func (*ClientListCtx) SetDeleteQuery ¶
func (t *ClientListCtx) SetDeleteQuery(field string, param bool) *ClientListCtx
SetDeleteQuery 设置删除查询 如果启动此设定,请注意基于查询条件的$顺序,叠加后使用,否则讲造成条件和参数不匹配
func (*ClientListCtx) SetFieldsAll ¶ added in v5.1.39
func (t *ClientListCtx) SetFieldsAll() *ClientListCtx
func (*ClientListCtx) SetFieldsList ¶
func (t *ClientListCtx) SetFieldsList(fields []string) *ClientListCtx
func (*ClientListCtx) SetFieldsSort ¶
func (t *ClientListCtx) SetFieldsSort(fields []string) *ClientListCtx
func (*ClientListCtx) SetFieldsSortDefault ¶ added in v5.1.39
func (t *ClientListCtx) SetFieldsSortDefault() *ClientListCtx
func (*ClientListCtx) SetFloat ¶ added in v5.2.35
func (t *ClientListCtx) SetFloat(field string, param float64) *ClientListCtx
SetFloat 常规Int判断查询(非)
func (*ClientListCtx) SetIDNoQuery ¶ added in v5.2.14
func (t *ClientListCtx) SetIDNoQuery(field string, param int64) *ClientListCtx
func (*ClientListCtx) SetIDQuery ¶
func (t *ClientListCtx) SetIDQuery(field string, param int64) *ClientListCtx
SetIDQuery 常规ID判断查询
func (*ClientListCtx) SetIDThanLessQuery ¶ added in v5.1.40
func (t *ClientListCtx) SetIDThanLessQuery(field string, param int64) *ClientListCtx
SetIDThanLessQuery 小于ID判断
func (*ClientListCtx) SetIDsAndMoreQuery ¶ added in v5.1.44
func (t *ClientListCtx) SetIDsAndMoreQuery(field string, param pq.Int64Array) *ClientListCtx
SetIDsAndMoreQuery 多个列交叉比对 和
func (*ClientListCtx) SetIDsMixMoreQuery ¶ added in v5.1.44
func (t *ClientListCtx) SetIDsMixMoreQuery(field string, isOr bool, param pq.Int64Array) *ClientListCtx
SetIDsMixMoreQuery 多个列交叉比对 和、或
func (*ClientListCtx) SetIDsOrMoreQuery ¶ added in v5.1.44
func (t *ClientListCtx) SetIDsOrMoreQuery(field string, param pq.Int64Array) *ClientListCtx
SetIDsOrMoreQuery 多个列交叉比对 或
func (*ClientListCtx) SetIDsQuery ¶ added in v5.1.5
func (t *ClientListCtx) SetIDsQuery(field string, param pq.Int64Array) *ClientListCtx
SetIDsQuery 常规IDs判断查询
func (*ClientListCtx) SetInt64BetweenQuery ¶ added in v5.1.44
func (t *ClientListCtx) SetInt64BetweenQuery(field string, minParam int64, maxParam int64) *ClientListCtx
SetInt64BetweenQuery 整数在指定范围内
func (*ClientListCtx) SetIntNoQuery ¶ added in v5.1.34
func (t *ClientListCtx) SetIntNoQuery(field string, param int) *ClientListCtx
SetIntNoQuery 常规Int判断查询(非)
func (*ClientListCtx) SetIntQuery ¶ added in v5.1.5
func (t *ClientListCtx) SetIntQuery(field string, param int) *ClientListCtx
SetIntQuery 常规Int判断查询
func (*ClientListCtx) SetPages ¶
func (t *ClientListCtx) SetPages(pages ArgsPages) *ClientListCtx
func (*ClientListCtx) SetSearchQuery ¶
func (t *ClientListCtx) SetSearchQuery(fields []string, search string) *ClientListCtx
SetSearchQuery 设置搜索查询 如果启动此设定,请注意基于查询条件的$顺序,叠加后使用,否则讲造成条件和参数不匹配
func (*ClientListCtx) SetStringNoNullQuery ¶ added in v5.1.39
func (t *ClientListCtx) SetStringNoNullQuery(field string) *ClientListCtx
func (*ClientListCtx) SetStringQuery ¶
func (t *ClientListCtx) SetStringQuery(field string, param string) *ClientListCtx
SetStringQuery 常规字符串判断查询
func (*ClientListCtx) SetTimeBetweenByArgQuery ¶ added in v5.1.24
func (t *ClientListCtx) SetTimeBetweenByArgQuery(field string, betweenAt ArgsTimeBetween) *ClientListCtx
SetTimeBetweenByArgQuery 设置时间范围
func (*ClientListCtx) SetTimeBetweenQuery ¶ added in v5.1.8
func (t *ClientListCtx) SetTimeBetweenQuery(field string, startAt time.Time, endAt time.Time) *ClientListCtx
SetTimeBetweenQuery 设置时间范围
func (*ClientListCtx) SetTimeExistQuery ¶ added in v5.1.44
func (t *ClientListCtx) SetTimeExistQuery(field string, needParam bool, param bool) *ClientListCtx
SetTimeExistQuery 设置时间查询 如果启动此设定,请注意基于查询条件的$顺序,叠加后使用,否则讲造成条件和参数不匹配
type ClientUpdateCtx ¶
type ClientUpdateCtx struct {
// contains filtered or unexported fields
}
func (*ClientUpdateCtx) AddWhereID ¶
func (t *ClientUpdateCtx) AddWhereID(id int64) *ClientUpdateCtx
func (*ClientUpdateCtx) AddWhereOrgID ¶
func (t *ClientUpdateCtx) AddWhereOrgID(orgID int64) *ClientUpdateCtx
func (*ClientUpdateCtx) AddWhereUserID ¶
func (t *ClientUpdateCtx) AddWhereUserID(userID int64) *ClientUpdateCtx
func (*ClientUpdateCtx) GetLastQuery ¶ added in v5.1.39
func (t *ClientUpdateCtx) GetLastQuery() string
func (*ClientUpdateCtx) NamedExec ¶
func (t *ClientUpdateCtx) NamedExec(arg map[string]interface{}) error
func (*ClientUpdateCtx) NeedSoft ¶
func (t *ClientUpdateCtx) NeedSoft(b bool) *ClientUpdateCtx
NeedSoft 是否软删除
func (*ClientUpdateCtx) NeedUpdateTime ¶
func (t *ClientUpdateCtx) NeedUpdateTime() *ClientUpdateCtx
func (*ClientUpdateCtx) SetDefaultFields ¶ added in v5.1.39
func (t *ClientUpdateCtx) SetDefaultFields() *ClientUpdateCtx
func (*ClientUpdateCtx) SetFieldStr ¶
func (t *ClientUpdateCtx) SetFieldStr(fields string) *ClientUpdateCtx
func (*ClientUpdateCtx) SetFields ¶
func (t *ClientUpdateCtx) SetFields(fields []string) *ClientUpdateCtx
func (*ClientUpdateCtx) SetWhereAnd ¶
func (t *ClientUpdateCtx) SetWhereAnd(name string, val interface{}) *ClientUpdateCtx
func (*ClientUpdateCtx) SetWhereOrThan ¶
func (t *ClientUpdateCtx) SetWhereOrThan(name string, val interface{}) *ClientUpdateCtx
func (*ClientUpdateCtx) SetWhereStr ¶
func (t *ClientUpdateCtx) SetWhereStr(where string, arg map[string]interface{}) *ClientUpdateCtx
SetWhereStr 追加覆盖条件部分
type FieldsAddress ¶
type FieldsAddress struct { //所属国家 国家代码 // eg: china => 86 Country int `db:"country" json:"country"` //省份 编码 // eg: 710000 Province int `db:"province" json:"province"` //所属城市 City int `db:"city" json:"city" check:"city"` //街道详细信息 Address string `db:"address" json:"address"` //地图制式 // 0 WGS-84 / 1 GCJ-02 / 2 BD-09 MapType int `db:"map_type" json:"mapType"` //坐标位置 Longitude float64 `db:"longitude" json:"longitude"` Latitude float64 `db:"latitude" json:"latitude"` //联系人姓名 Name string `db:"name" json:"name"` //联系人国家代码 NationCode string `db:"nation_code" json:"nationCode"` //联系人手机号 Phone string `db:"phone" json:"phone"` }
FieldsAddress 通用地址结构
func (*FieldsAddress) Check ¶
func (t *FieldsAddress) Check() (err error)
func (*FieldsAddress) GetMapType ¶
func (t *FieldsAddress) GetMapType() (data string)
func (*FieldsAddress) Scan ¶
func (t *FieldsAddress) Scan(value interface{}) error
type FieldsConfig ¶
type FieldsConfig struct { //标识码 Mark string `db:"mark" json:"mark"` //值 Val string `db:"val" json:"val"` }
FieldsConfig 扩展结构
func (*FieldsConfig) Scan ¶
func (t *FieldsConfig) Scan(value interface{}) error
type FieldsConfigList ¶
type FieldsConfigList []FieldsConfig
FieldsConfigList 简化得扩展结构
func (FieldsConfigList) CheckVal ¶
func (t FieldsConfigList) CheckVal(mark string, val string) (nowVal string, b bool)
CheckVal 检查一组数据内的值是否匹配
func (FieldsConfigList) GetVal ¶
func (t FieldsConfigList) GetVal(mark string) (val string, b bool)
GetVal 抽取指定的值
func (FieldsConfigList) GetValBool ¶
func (t FieldsConfigList) GetValBool(mark string) (val bool, b bool)
GetValBool 抽取指定的值
func (FieldsConfigList) GetValFloat64 ¶
func (t FieldsConfigList) GetValFloat64(mark string) (val float64, b bool)
GetValFloat64 抽取指定的值
func (FieldsConfigList) GetValInt ¶
func (t FieldsConfigList) GetValInt(mark string) (val int, b bool)
GetValInt 抽取指定的值
func (FieldsConfigList) GetValInt64 ¶
func (t FieldsConfigList) GetValInt64(mark string) (val int64, b bool)
GetValInt64 抽取指定的值
func (FieldsConfigList) GetValInt64NoBool ¶
func (t FieldsConfigList) GetValInt64NoBool(mark string) (val int64)
func (FieldsConfigList) GetValNoBool ¶
func (t FieldsConfigList) GetValNoBool(mark string) (val string)
func (FieldsConfigList) GetValNoErr ¶
func (t FieldsConfigList) GetValNoErr(mark string) (val string)
func (*FieldsConfigList) Scan ¶
func (t *FieldsConfigList) Scan(value interface{}) error
type FieldsGPS ¶
type FieldsGPS struct { //坐标位置 Longitude float64 `db:"longitude" json:"longitude"` Latitude float64 `db:"latitude" json:"latitude"` }
FieldsGPS 坐标设计
type FieldsTimeBetween ¶
type FieldsTimeBetween struct { //最小时间 MinTime time.Time `json:"minTime"` //最大时间 MaxTime time.Time `json:"maxTime"` }
func (*FieldsTimeBetween) GetData ¶
func (t *FieldsTimeBetween) GetData() ArgsTimeBetween
type SQLClient ¶
type SQLClient struct {
// contains filtered or unexported fields
}
SQLClient SQL操作控制器核心 初始化连接后需使用本结构构建控制对象,写入基础数据集
func (*SQLClient) GetPostgresql ¶
func (t *SQLClient) GetPostgresql() *CorePostgres.Client
GetPostgresql 获取postgresql句柄
func (*SQLClient) InitPostgresql ¶
func (t *SQLClient) InitPostgresql(mainDB *CorePostgres.Client)
InitPostgresql 初始化
Source Files ¶
- args_address.go
- args_between.go
- args_config.go
- args_gps.go
- args_id.go
- args_page.go
- client.go
- client_cache.go
- client_core.go
- client_tools.go
- client_tools_analysis.go
- client_tools_delete.go
- client_tools_get.go
- client_tools_insert.go
- client_tools_select.go
- client_tools_update.go
- core.go
- db_stretch.go
- install.go
- log.go