Documentation ¶
Index ¶
- Variables
- func GetRDBClient(rdb *tiga.RedisDao) *redis.Client
- func NewAppRepo(cfg *tiga.Configuration, log logger.Logger) biz.AppRepo
- func NewAppRepoImpl(curd biz.CURD, local *LayeredCache, cfg *config.Config) biz.AppRepo
- func NewAuthzRepo(cfg *tiga.Configuration, log logger.Logger) biz.AuthzRepo
- func NewAuthzRepoImpl(log logger.Logger, local *LayeredCache) biz.AuthzRepo
- func NewCurdImpl(db *tiga.MySQLDao, conf *config.Config) biz.CURD
- func NewDataLock(client *redis.Client, key string, ttl time.Duration, retry int) biz.DataLock
- func NewDataOperatorRepo(data *Data, app biz.AppRepo, user biz.UserRepo, authz biz.AuthzRepo, ...) biz.DataOperatorRepo
- func NewEndpointRepo(cfg *tiga.Configuration, log logger.Logger) endpoint.EndpointRepo
- func NewEndpointRepoImpl(data *Data, cfg *config.Config) endpoint.EndpointRepo
- func NewEtcd(config *tiga.Configuration) *tiga.EtcdDao
- func NewLocker(cfg *tiga.Configuration, log logger.Logger, key string, ttl time.Duration, ...) biz.DataLock
- func NewMySQL(config *tiga.Configuration) *tiga.MySQLDao
- func NewOperator(cfg *tiga.Configuration, log logger.Logger) biz.DataOperatorRepo
- func NewRDB(config *tiga.Configuration) *tiga.RedisDao
- func NewUserRepo(cfg *tiga.Configuration, log logger.Logger) biz.UserRepo
- func NewUserRepoImpl(data *Data, local *LayeredCache, curd biz.CURD, cfg *config.Config) biz.UserRepo
- type Data
- type LayeredCache
- func (l *LayeredCache) AddToFilter(ctx context.Context, key string, value []byte) error
- func (l *LayeredCache) CheckInFilter(ctx context.Context, key string, value []byte) (bool, error)
- func (l *LayeredCache) Del(ctx context.Context, key string) error
- func (l *LayeredCache) DelInFilter(ctx context.Context, key string, value []byte) error
- func (l *LayeredCache) Get(ctx context.Context, key string) ([]byte, error)
- func (l *LayeredCache) GetFromLocal(ctx context.Context, key string) ([]byte, error)
- func (l *LayeredCache) Set(ctx context.Context, key string, value []byte, exp time.Duration) error
- func (l *LayeredCache) SetToLocal(ctx context.Context, key string, value []byte, exp time.Duration) error
- func (l *LayeredCache) Watch(ctx context.Context)
- type SourceType
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet(NewMySQL, NewRDB, NewEtcd, GetRDBClient, NewData, NewCurdImpl, NewLayeredCache, NewDataLock, NewAuthzRepoImpl, NewUserRepoImpl, NewEndpointRepoImpl, NewAppRepoImpl, NewDataOperatorRepo)
Functions ¶
func GetRDBClient ¶
func NewAppRepo ¶
func NewAppRepoImpl ¶
func NewAuthzRepo ¶
func NewAuthzRepoImpl ¶
func NewAuthzRepoImpl(log logger.Logger, local *LayeredCache) biz.AuthzRepo
func NewDataLock ¶
func NewDataOperatorRepo ¶
func NewEndpointRepo ¶
func NewEndpointRepo(cfg *tiga.Configuration, log logger.Logger) endpoint.EndpointRepo
func NewEndpointRepoImpl ¶
func NewEndpointRepoImpl(data *Data, cfg *config.Config) endpoint.EndpointRepo
func NewOperator ¶
func NewOperator(cfg *tiga.Configuration, log logger.Logger) biz.DataOperatorRepo
func NewUserRepo ¶
func NewUserRepoImpl ¶
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func NewDataRepo ¶
func NewDataRepo(cfg *tiga.Configuration, log logger.Logger) *Data
func (*Data) BatchCacheByTx ¶
func (d *Data) BatchCacheByTx(ctx context.Context, exp time.Duration, kv ...interface{}) redis.Pipeliner
if err != nil { return errors.Wrap(err, "更新失败") } return nil }
func (d *Data) Cache(ctx context.Context, key string, value string, exp time.Duration) error { return d.rdb.Set(ctx, key, value, exp) }
func (d *Data) GetCache(ctx context.Context, key string) string { return d.rdb.Get(ctx, key) }
func (*Data) PutEtcdWithTxn ¶
func (d *Data) BatchEtcdDelete(models []SourceType) error { if len(models) == 0 { return nil } if len(models) == 1 { key, val, err := getPrimaryColumnValue(models[0], "primary") if err != nil { return fmt.Errorf("get primary column value failed: %w", err) } return d.db.Delete(models[0], fmt.Sprintf("%s=?", key), val) } keys := make([]string, 0) dataModel := models[0] _in := "uid in ?" for _, item := range models { key, val, err := getPrimaryColumnValue(item, "primary") _in = fmt.Sprintf("%s in ?", key) if err != nil { return fmt.Errorf("get primary column value failed: %w", err) } keys = append(keys, val.(string)) } return d.db.Delete(dataModel, _in, keys) }
func (d *Data) EtcdPut(ctx context.Context, key string, value string, opts ...clientv3.OpOption) error { return d.etcd.Put(ctx, key, value, opts...) }
type LayeredCache ¶
type LayeredCache struct {
// contains filtered or unexported fields
}
func NewLayered ¶
func NewLayered(cfg *tiga.Configuration, log logger.Logger) *LayeredCache
func NewLayeredCache ¶
NewLayeredCache creates a new layered cache only once
func (*LayeredCache) AddToFilter ¶
func (*LayeredCache) CheckInFilter ¶
func (*LayeredCache) DelInFilter ¶
func (*LayeredCache) GetFromLocal ¶
func (*LayeredCache) SetToLocal ¶
func (*LayeredCache) Watch ¶
func (l *LayeredCache) Watch(ctx context.Context)
type SourceType ¶
type SourceType interface { // 获取数据源类型 GetUpdateMask() *fieldmaskpb.FieldMask }
Click to show internal directories.
Click to hide internal directories.