Documentation ¶
Index ¶
- Constants
- Variables
- func BatchOperation(label string, data []interface{}, handler BatchHandler) error
- func BatchQuery(label string, data []interface{}, handler BatchHandler) error
- func NewSqlDBTx(delegateTx *BaseTx) store.Tx
- func PlaceholdersN(size int) string
- func Retry(label string, handle func() error)
- func RetryTransaction(label string, handle func() error) error
- type BaseDB
- type BaseTx
- type BatchHandler
- type LeaderElectionStore
- type Order
- type Page
- type QueryHandler
- type Tx
Constants ¶
View Source
const ( // SystemNamespace system namespace SystemNamespace = "Polaris" // STORENAME database storage name STORENAME = "defaultStore" // DefaultConnMaxLifetime default maximum connection lifetime DefaultConnMaxLifetime = 60 * 30 // 默认是30分钟 )
View Source
const ( // IDAttribute is the name of the attribute that stores the ID of the object. IDAttribute string = "id" // NameAttribute will be used as the name of the attribute that stores the name of the object. NameAttribute string = "name" // FlagAttribute will be used as the name of the attribute that stores the flag of the object. FlagAttribute string = "flag" // GroupIDAttribute will be used as the name of the attribute that stores the group ID of the object. GroupIDAttribute string = "group_id" )
View Source
const ( TickTime = 2 LeaseTime = 10 )
View Source
const ( // OwnerAttribute OwnerAttribute string = "owner" // And And string = " and" )
Variables ¶
View Source
var ( RuleFilters map[string]string = map[string]string{ "res_id": "ar.res_id", "res_type": "ar.res_type", "default": "ag.default", "owner": "ag.owner", "name": "ag.name", "principal_id": "ap.principal_id", "principal_type": "ap.principal_role", } RuleNeedLikeFilters map[string]struct{} = map[string]struct{}{ "name": {}, } )
Functions ¶
func BatchOperation ¶
func BatchOperation(label string, data []interface{}, handler BatchHandler) error
BatchOperation 批量操作 @note 每次最多操作100个
func BatchQuery ¶
func BatchQuery(label string, data []interface{}, handler BatchHandler) error
BatchQuery 批量查询数据的对外接口 每次最多查询200个
func NewSqlDBTx ¶
func RetryTransaction ¶
RetryTransaction 事务重试
Types ¶
type BaseDB ¶
BaseDB 对sql.DB的封装
func NewBaseDB ¶
func NewBaseDB(cfg *dbConfig, parsePwd plugin.ParsePassword) (*BaseDB, error)
NewBaseDB 新建一个BaseDB
type LeaderElectionStore ¶
type LeaderElectionStore interface { // CreateLeaderElection CreateLeaderElection(key string) error // GetVersion get current version GetVersion(key string) (int64, error) // CompareAndSwapVersion cas version CompareAndSwapVersion(key string, curVersion int64, newVersion int64, leader string) (bool, error) // CheckMtimeExpired check mtime expired CheckMtimeExpired(key string, leaseTime int32) (bool, error) // ListLeaderElections list all leaderelection ListLeaderElections() ([]*model.LeaderElection, error) }
LeaderElectionStore store inteface
type QueryHandler ¶
QueryHandler is the interface that wraps the basic Query method.
Source Files ¶
- base_db.go
- circuitbreaker_config.go
- circuitbreaker_config_v2.go
- client.go
- common.go
- config_file.go
- config_file_group.go
- config_file_release.go
- config_file_release_history.go
- config_file_tag.go
- config_file_template.go
- default.go
- fault_detect_config.go
- group.go
- instance.go
- l5.go
- log.go
- maintain.go
- namespace.go
- ratelimit_config.go
- routing_config.go
- routing_config_v2.go
- service.go
- sql.go
- strategy.go
- tool.go
- transaction.go
- tx.go
- user.go
Click to show internal directories.
Click to hide internal directories.