Documentation ¶
Overview ¶
Package sqldb is a generated GoMock package.
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 MockLeaderElectionStore
- func (m *MockLeaderElectionStore) CheckMtimeExpired(key string, leaseTime int32) (bool, error)
- func (m *MockLeaderElectionStore) CompareAndSwapVersion(key string, curVersion, newVersion int64, leader string) (bool, error)
- func (m *MockLeaderElectionStore) EXPECT() *MockLeaderElectionStoreMockRecorder
- func (m *MockLeaderElectionStore) GetVersion(key string) (int64, error)
- type MockLeaderElectionStoreMockRecorder
- func (mr *MockLeaderElectionStoreMockRecorder) CheckMtimeExpired(key, leaseTime interface{}) *gomock.Call
- func (mr *MockLeaderElectionStoreMockRecorder) CompareAndSwapVersion(key, curVersion, newVersion, leader interface{}) *gomock.Call
- func (mr *MockLeaderElectionStoreMockRecorder) GetVersion(key interface{}) *gomock.Call
- type Order
- type Page
- type QueryHandler
- type Tx
Constants ¶
const ( // SystemNamespace system namespace SystemNamespace = "Polaris" // STORENAME database storage name STORENAME = "defaultStore" // DefaultConnMaxLifetime default maximum connection lifetime DefaultConnMaxLifetime = 60 * 30 // 默认是30分钟 )
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" )
const ( DefaultElectKey = "polaris-server" TickTime = 2 LeaseTime = 10 )
const ( // OwnerAttribute OwnerAttribute string = "owner" // And And string = " and" )
Variables ¶
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": {}, } )
var (
ErrMultipleConfigFileGroupFound error = errors.New("multiple config_file_group found")
)
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 ¶ added in v1.13.1
type LeaderElectionStore interface { // 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) }
LeaderElectionStore store inteface
type MockLeaderElectionStore ¶ added in v1.13.1
type MockLeaderElectionStore struct {
// contains filtered or unexported fields
}
MockLeaderElectionStore is a mock of LeaderElectionStore interface.
func NewMockLeaderElectionStore ¶ added in v1.13.1
func NewMockLeaderElectionStore(ctrl *gomock.Controller) *MockLeaderElectionStore
NewMockLeaderElectionStore creates a new mock instance.
func (*MockLeaderElectionStore) CheckMtimeExpired ¶ added in v1.13.1
func (m *MockLeaderElectionStore) CheckMtimeExpired(key string, leaseTime int32) (bool, error)
CheckMtimeExpired mocks base method.
func (*MockLeaderElectionStore) CompareAndSwapVersion ¶ added in v1.13.1
func (m *MockLeaderElectionStore) CompareAndSwapVersion(key string, curVersion, newVersion int64, leader string) (bool, error)
CompareAndSwapVersion mocks base method.
func (*MockLeaderElectionStore) EXPECT ¶ added in v1.13.1
func (m *MockLeaderElectionStore) EXPECT() *MockLeaderElectionStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLeaderElectionStore) GetVersion ¶ added in v1.13.1
func (m *MockLeaderElectionStore) GetVersion(key string) (int64, error)
GetVersion mocks base method.
type MockLeaderElectionStoreMockRecorder ¶ added in v1.13.1
type MockLeaderElectionStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockLeaderElectionStoreMockRecorder is the mock recorder for MockLeaderElectionStore.
func (*MockLeaderElectionStoreMockRecorder) CheckMtimeExpired ¶ added in v1.13.1
func (mr *MockLeaderElectionStoreMockRecorder) CheckMtimeExpired(key, leaseTime interface{}) *gomock.Call
CheckMtimeExpired indicates an expected call of CheckMtimeExpired.
func (*MockLeaderElectionStoreMockRecorder) CompareAndSwapVersion ¶ added in v1.13.1
func (mr *MockLeaderElectionStoreMockRecorder) CompareAndSwapVersion(key, curVersion, newVersion, leader interface{}) *gomock.Call
CompareAndSwapVersion indicates an expected call of CompareAndSwapVersion.
func (*MockLeaderElectionStoreMockRecorder) GetVersion ¶ added in v1.13.1
func (mr *MockLeaderElectionStoreMockRecorder) GetVersion(key interface{}) *gomock.Call
GetVersion indicates an expected call of GetVersion.
type QueryHandler ¶
QueryHandler is the interface that wraps the basic Query method.
Source Files ¶
- base_db.go
- circuitbreaker_config.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
- group.go
- instance.go
- l5.go
- log.go
- maintain.go
- maintain_mock.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