Documentation ¶
Index ¶
- Constants
- func ConcatWithSepFunc(dialect string) func(string, ...any) exp.Expression
- func ConnectWithRetries(driverName, connStr string, retries uint64) (*sqlx.DB, error)
- type ConnPoolConf
- type DBOpt
- type DBStorage
- type Policy
- type PolicyAncestor
- type PolicyCount
- type PolicyDefWrapper
- type PolicyDependency
- type PolicyRevision
- type Schema
Constants ¶
View Source
const ( PolicyTbl = "policy" PolicyTblIDCol = "id" PolicyTblKindCol = "kind" PolicyTblNameCol = "name" PolicyTblVerCol = "version" PolicyTblScopeCol = "scope" PolicyTblDescCol = "description" PolicyTblDefinitionCol = "definition" PolicyTblDisabledCol = "disabled" PolicyDepTbl = "policy_dependency" PolicyDepTblPolicyIDCol = "policy_id" PolicyDepTblDepIDCol = "dependency_id" PolicyAncestorTbl = "policy_ancestor" PolicyAncestorTblPolicyIDCol = "policy_id" PolicyAncestorTblAncestorIDCol = "ancestor_id" PolicyRevisionTbl = "policy_revision" SchemaTbl = "attr_schema_defs" SchemaTblIDCol = "id" SchemaTblDefinitionCol = "definition" )
View Source
const DBConnectionRetries = 3
Variables ¶
This section is empty.
Functions ¶
func ConcatWithSepFunc ¶ added in v0.12.0
func ConcatWithSepFunc(dialect string) func(string, ...any) exp.Expression
Types ¶
type ConnPoolConf ¶
type ConnPoolConf struct { MaxLifetime time.Duration `yaml:"maxLifeTime"` MaxIdleTime time.Duration `yaml:"maxIdleTime"` MaxOpen uint `yaml:"maxOpen"` MaxIdle uint `yaml:"maxIdle"` }
ConnPoolConf holds common SQL connection pool settings.
func (*ConnPoolConf) Configure ¶
func (cc *ConnPoolConf) Configure(db *sqlx.DB)
type DBOpt ¶ added in v0.13.0
type DBOpt func(*dbOpt)
DBOpt defines database driver options.
func WithRegexpCacheOverride ¶ added in v0.29.0
func WithRegexpCacheOverride(c *util.RegexpCache) DBOpt
WithRegexpCacheOverride overrides the default regexp cache for DB queries requiring compiled expressions. This is only required for DB drivers that require access to the cache (e.g. The SQLite driver retrieves the compiled expressions for the application-defined function).
func WithUpsertPolicy ¶ added in v0.13.0
func WithUpsertPolicy(f upsertPolicyFunc) DBOpt
WithUpsertPolicy sets custom upsert policy function.
func WithUpsertSchema ¶ added in v0.13.0
func WithUpsertSchema(f upsertSchemaFunc) DBOpt
WithUpsertSchema sets custom upsert schema function.
type DBStorage ¶
type DBStorage interface { storage.Subscribable storage.Instrumented storage.Reloadable storage.Verifiable AddOrUpdate(ctx context.Context, policies ...policy.Wrapper) error GetFirstMatch(ctx context.Context, candidates []namer.ModuleID) (*policy.CompilationUnit, error) GetCompilationUnits(ctx context.Context, ids ...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error) GetDependents(ctx context.Context, ids ...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error) HasDescendants(ctx context.Context, ids ...namer.ModuleID) (map[namer.ModuleID]bool, error) Delete(ctx context.Context, ids ...namer.ModuleID) error ListPolicyIDs(ctx context.Context, params storage.ListPolicyIDsParams) ([]string, error) ListSchemaIDs(ctx context.Context) ([]string, error) AddOrUpdateSchema(ctx context.Context, schemas ...*schemav1.Schema) error Disable(ctx context.Context, policyKey ...string) (uint32, error) Enable(ctx context.Context, policyKey ...string) (uint32, error) DeleteSchema(ctx context.Context, ids ...string) (uint32, error) LoadSchema(ctx context.Context, url string) (io.ReadCloser, error) LoadPolicy(ctx context.Context, policyKey ...string) ([]*policy.Wrapper, error) }
type PolicyAncestor ¶ added in v0.13.0
type PolicyCount ¶ added in v0.15.0
type PolicyDefWrapper ¶
func (*PolicyDefWrapper) Scan ¶
func (pdw *PolicyDefWrapper) Scan(src any) error
type PolicyDependency ¶
type PolicyRevision ¶ added in v0.7.0
Click to show internal directories.
Click to hide internal directories.