Documentation ¶
Index ¶
- Constants
- func ConcatWithSepFunc(dialect string) func(string, ...any) exp.Expression
- func ConnectWithRetries(driverName, connStr string, retryConf *ConnRetryConf) (*sqlx.DB, error)
- type ConnPoolConf
- type ConnRetryConf
- 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" )
Variables ¶
This section is empty.
Functions ¶
func ConcatWithSepFunc ¶ added in v0.12.0
func ConcatWithSepFunc(dialect string) func(string, ...any) exp.Expression
func ConnectWithRetries ¶ added in v0.24.0
func ConnectWithRetries(driverName, connStr string, retryConf *ConnRetryConf) (*sqlx.DB, error)
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 ConnRetryConf ¶ added in v0.33.0
type ConnRetryConf struct { // MaxAttempts is the maximum number of retries to attempt before giving up. MaxAttempts uint64 `yaml:"maxAttempts"` // InitialInterval is the initial wait period between retry attempts. Subsequent attempts will be longer depending on the attempt number. InitialInterval time.Duration `yaml:"initialInterval"` // MaxInterval is the maximum amount of time to wait between retry attempts. MaxInterval time.Duration `yaml:"maxInterval"` }
ConnRetryConf holds common retry settings for establishing a database connection.
func (*ConnRetryConf) BackoffConf ¶ added in v0.33.0
func (rc *ConnRetryConf) BackoffConf() backoff.BackOff
func (*ConnRetryConf) Validate ¶ added in v0.33.0
func (rc *ConnRetryConf) Validate() (outErr error)
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 WithSourceAttributes ¶ added in v0.33.0
func WithSourceAttributes(attr ...policy.SourceAttribute) DBOpt
WithSourceAttributes sets the policy source attributes.
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 InspectPolicies(ctx context.Context, params storage.ListPolicyIDsParams) (map[string]*responsev1.InspectPoliciesResponse_Result, 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.