Documentation
¶
Index ¶
- type MysqlClient
- func (m *MysqlClient) Check() error
- func (m *MysqlClient) Close()
- func (m *MysqlClient) GetConnection(dbName ...string) (*gorm.DB, error)
- func (m *MysqlClient) Init(mysqlConfigData []byte)
- func (m *MysqlClient) IsMultiDB() bool
- func (m *MysqlClient) ListConnNames() []string
- func (m *MysqlClient) UseCache() bool
- type RedisCacher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlClient ¶
type MysqlClient struct {
// contains filtered or unexported fields
}
func (*MysqlClient) Check ¶
func (m *MysqlClient) Check() error
func (*MysqlClient) Close ¶
func (m *MysqlClient) Close()
func (*MysqlClient) GetConnection ¶
func (m *MysqlClient) GetConnection(dbName ...string) (*gorm.DB, error)
func (*MysqlClient) Init ¶
func (m *MysqlClient) Init(mysqlConfigData []byte)
func (*MysqlClient) IsMultiDB ¶
func (m *MysqlClient) IsMultiDB() bool
func (*MysqlClient) ListConnNames ¶
func (m *MysqlClient) ListConnNames() []string
func (*MysqlClient) UseCache ¶
func (m *MysqlClient) UseCache() bool
type RedisCacher ¶
type RedisCacher struct {
Rdb redis.UniversalClient
Expiration time.Duration
}
1. 定义你的 Redis Cacher 结构体
func (*RedisCacher) Get ¶
func (c *RedisCacher) Get(ctx context.Context, key string, q *caches.Query[any]) (*caches.Query[any], error)
2. 实现 Get 方法
func (*RedisCacher) Invalidate ¶
func (c *RedisCacher) Invalidate(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.