Documentation
¶
Index ¶
- Variables
- func InitializeMysql(config dirver.LinkParams) *gorm.DB
- func InitializeWebsocket(pattern string, address string) *socket.WebSocket
- type CommonModel
- type Database
- func (d *Database) AutoMigrate() error
- func (d *Database) Begin() *gorm.DB
- func (d *Database) Create(model any) error
- func (d *Database) Delete(model any) error
- func (d *Database) DeleteByWhere(where any) error
- func (d *Database) ExecuteSql(sql string, logMod ...bool) error
- func (d *Database) Exist(where Where) (bool, error)
- func (d *Database) Find(id any) error
- func (d *Database) First(where Where, not ...Where) error
- func (d *Database) Get(where ...any) error
- func (d *Database) GetByPage(pagination PaginationQuery, where any) PageData
- func (d *Database) GetDb() *gorm.DB
- func (d *Database) GetTableComment(database string, table string) (string, error)
- func (d *Database) GetTableFieldComment(database string, table string) ([]Field, error)
- func (d *Database) Save(model any) error
- func (d *Database) SetMode() error
- func (d *Database) SetModel(executeModel any) *Database
- func (d *Database) SetResult(resultModel any) *Database
- type Field
- type ModelAction
- type PageData
- type PageInfo
- type PaginationQuery
- type RedisClient
- func (r *RedisClient) Delete(key string) *redis.IntCmd
- func (r *RedisClient) Get(key string) *redis.StringCmd
- func (r *RedisClient) HDel(key string, field string) *redis.IntCmd
- func (r *RedisClient) HGet(key string, field string) *redis.StringCmd
- func (r *RedisClient) HGetAll(key string) *redis.MapStringStringCmd
- func (r *RedisClient) HSet(key string, params map[string]any) *redis.IntCmd
- func (r *RedisClient) HSetNX(key string, field string, value any) *redis.BoolCmd
- func (r *RedisClient) Keys(pattern string) *redis.StringSliceCmd
- func (r *RedisClient) LPop(key string) *redis.StringCmd
- func (r *RedisClient) LPush(key string, values ...any) *redis.IntCmd
- func (r *RedisClient) Publish(channel string, message any) error
- func (r *RedisClient) Set(key string, value any, expiration ...time.Duration) *redis.StatusCmd
- func (r *RedisClient) SetContext(ctx context.Context)
- func (r *RedisClient) SetNx(key string, value any, expiration ...time.Duration) *redis.BoolCmd
- func (r *RedisClient) Subscribe(channel string, callback SubscribeCallback) error
- type SubscribeCallback
- type Where
Constants ¶
This section is empty.
Variables ¶
View Source
var WebsocketHandler *socket.WebSocket
Functions ¶
func InitializeMysql ¶
func InitializeMysql(config dirver.LinkParams) *gorm.DB
InitializeMysql 初始化数据库连接
Types ¶
type CommonModel ¶
type CommonModel struct { Id int `gorm:"column:id" json:"id"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` }
CommonModel 数据库类型基类
type Database ¶
type Database struct { Result any // contains filtered or unexported fields }
Database 基础模型
var DBHandler *Database
DBHandler 数据库操作句柄
func (*Database) DeleteByWhere ¶
DeleteByWhere 删除数据
func (*Database) ExecuteSql ¶
ExecuteSql 执行sql
func (*Database) GetByPage ¶
func (d *Database) GetByPage(pagination PaginationQuery, where any) PageData
GetByPage 分页查询数据
func (*Database) GetTableComment ¶
func (*Database) GetTableFieldComment ¶
type ModelAction ¶
type PaginationQuery ¶
type PaginationQuery struct { PageSize int PageNum int // OrderBy 小写的字段名称 OrderBy string // Order 默认是'desc', 可选的: 'desc', 'asc' Order string }
PaginationQuery 分页查询
type RedisClient ¶
type RedisClient struct { *redis.Ring // contains filtered or unexported fields }
RedisClient Redis客户端
var RedisHandler *RedisClient
RedisHandler Redis操作句柄
func (*RedisClient) Delete ¶
func (r *RedisClient) Delete(key string) *redis.IntCmd
func (*RedisClient) Get ¶
func (r *RedisClient) Get(key string) *redis.StringCmd
func (*RedisClient) HDel ¶
func (r *RedisClient) HDel(key string, field string) *redis.IntCmd
func (*RedisClient) HGet ¶
func (r *RedisClient) HGet(key string, field string) *redis.StringCmd
func (*RedisClient) HGetAll ¶
func (r *RedisClient) HGetAll(key string) *redis.MapStringStringCmd
HGetAll 获取全部hash
func (*RedisClient) HSet ¶
func (r *RedisClient) HSet(key string, params map[string]any) *redis.IntCmd
HSet hash设置
func (*RedisClient) HSetNX ¶
func (r *RedisClient) HSetNX(key string, field string, value any) *redis.BoolCmd
HSetNX hash设置
func (*RedisClient) Keys ¶
func (r *RedisClient) Keys(pattern string) *redis.StringSliceCmd
func (*RedisClient) LPop ¶
func (r *RedisClient) LPop(key string) *redis.StringCmd
func (*RedisClient) LPush ¶
func (r *RedisClient) LPush(key string, values ...any) *redis.IntCmd
func (*RedisClient) Publish ¶
func (r *RedisClient) Publish(channel string, message any) error
Publish 发布
func (*RedisClient) Set ¶
func (r *RedisClient) Set(key string, value any, expiration ...time.Duration) *redis.StatusCmd
Set 字符串设置
func (*RedisClient) SetContext ¶
func (r *RedisClient) SetContext(ctx context.Context)
SetContext 设置context
func (*RedisClient) SetNx ¶
func (r *RedisClient) SetNx(key string, value any, expiration ...time.Duration) *redis.BoolCmd
SetNx 字符串设置
func (*RedisClient) Subscribe ¶
func (r *RedisClient) Subscribe(channel string, callback SubscribeCallback) error
Subscribe 订阅
Click to show internal directories.
Click to hide internal directories.