Documentation
¶
Index ¶
- func OpenDatabase(connUrl string, databaseName string) (*sql.DB, error)
- type Database
- type Databases
- type DbInfo
- type DbOpener
- type DefaultGrant
- type DefaultGrantKey
- type DefaultGrants
- func (g *DefaultGrants) Create(grant DefaultGrant) (*DefaultGrant, error)
- func (g *DefaultGrants) Drop(key DefaultGrantKey) (bool, error)
- func (g *DefaultGrants) Read(key DefaultGrantKey) (*DefaultGrant, error)
- func (g *DefaultGrants) Update(key DefaultGrantKey, grant DefaultGrant) (*DefaultGrant, error)
- type FeatureName
- type Features
- type NoopRevoker
- type Revoker
- type Role
- type RoleAttributes
- type RoleMember
- type RoleMemberKey
- type RoleMembers
- type Roles
- type SchemaPrivilege
- type SchemaPrivilegeKey
- type SchemaPrivileges
- func (r *SchemaPrivileges) Create(obj SchemaPrivilege) (*SchemaPrivilege, error)
- func (r *SchemaPrivileges) Drop(key SchemaPrivilegeKey) (bool, error)
- func (r *SchemaPrivileges) Read(key SchemaPrivilegeKey) (*SchemaPrivilege, error)
- func (r *SchemaPrivileges) Update(key SchemaPrivilegeKey, obj SchemaPrivilege) (*SchemaPrivilege, error)
- type Store
- type TempGrant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct { Name string `json:"name"` Owner string `json:"owner"` Template string `json:"template"` Encoding string `json:"encoding"` Collation string `json:"collation"` LcCtype string `json:"lcCtype"` TablespaceName string `json:"tablespaceName"` ConnectionLimit int `json:"connectionLimit"` IsTemplate bool `json:"isTemplate"` DisableConnections bool `json:"disableConnections"` // Do not error if trying to create a database that already exists // Instead, read the existing and return UseExisting bool `json:"useExisting"` }
type Databases ¶ added in v0.5.0
type Databases struct {
DbOpener DbOpener
}
type DbInfo ¶
type DefaultGrant ¶ added in v0.5.0
type DefaultGrant struct { Id string `json:"id"` Role string `json:"role"` Target string `json:"target"` Database string `json:"database"` }
DefaultGrant defines a template of privileges that Role will be granted to Database This grants default privileges on schema objects created by Role in Database to Target
func (DefaultGrant) Key ¶ added in v0.5.0
func (g DefaultGrant) Key() DefaultGrantKey
func (*DefaultGrant) SetId ¶ added in v0.5.0
func (g *DefaultGrant) SetId()
type DefaultGrantKey ¶ added in v0.5.0
type DefaultGrants ¶ added in v0.5.0
type DefaultGrants struct {
DbOpener DbOpener
}
func (*DefaultGrants) Create ¶ added in v0.5.0
func (g *DefaultGrants) Create(grant DefaultGrant) (*DefaultGrant, error)
func (*DefaultGrants) Drop ¶ added in v0.5.0
func (g *DefaultGrants) Drop(key DefaultGrantKey) (bool, error)
func (*DefaultGrants) Read ¶ added in v0.5.0
func (g *DefaultGrants) Read(key DefaultGrantKey) (*DefaultGrant, error)
func (*DefaultGrants) Update ¶ added in v0.5.0
func (g *DefaultGrants) Update(key DefaultGrantKey, grant DefaultGrant) (*DefaultGrant, error)
type FeatureName ¶
type FeatureName uint
const ( FeatureCreateRoleWith FeatureName = iota FeatureDBAllowConnections FeatureDBIsTemplate FeatureFallbackApplicationName FeatureRLS FeatureSchemaCreateIfNotExist FeatureReplication FeatureExtension FeaturePrivileges FeatureForceDropDatabase FeaturePid )
type Features ¶
type Features map[FeatureName]bool
func CalcSupportedFeatures ¶
func (Features) IsSupported ¶
func (f Features) IsSupported(name FeatureName) bool
type NoopRevoker ¶ added in v0.1.1
type NoopRevoker struct { }
type Revoker ¶ added in v0.1.1
func GrantRoleMembership ¶ added in v0.1.1
GrantRoleMembership grants role membership of the target 'role' to the 'currentUser' This is used to perform commands if user is not a superuser For instance, when using AWS RDS, user is not given superuser It returns false if the grant is not needed because the user is already a member of this role.
type Role ¶
type Role struct { Name string `json:"name"` Password string `json:"password"` // Do not error if trying to create a role that already exists // Instead, read the existing, set the password, and return UseExisting bool `json:"useExisting"` // SkipPasswordUpdate informs Create to skip updating the role's password if the role already exists SkipPasswordUpdate bool `json:"-"` MemberOf []string `json:"memberOf"` Attributes RoleAttributes `json:"attributes"` }
type RoleAttributes ¶ added in v0.6.0
type RoleMember ¶ added in v0.5.0
type RoleMember struct { // Member receives all the permissions for Target Member string `json:"member"` // Target is the role that gains an additional Member Target string `json:"target"` // WithAdminOption permits Member to grant it to others WithAdminOption bool `json:"withAdminOption"` // Do not error if trying to create a role membership that already exists // Instead, return the existing UseExisting bool `json:"useExisting"` }
RoleMember adds Member to the Target role
func (RoleMember) Key ¶ added in v0.7.0
func (r RoleMember) Key() RoleMemberKey
type RoleMemberKey ¶ added in v0.5.0
type RoleMembers ¶ added in v0.5.0
type RoleMembers struct {
DbOpener DbOpener
}
func (*RoleMembers) Create ¶ added in v0.5.0
func (r *RoleMembers) Create(membership RoleMember) (*RoleMember, error)
func (*RoleMembers) Drop ¶ added in v0.5.0
func (r *RoleMembers) Drop(key RoleMemberKey) (bool, error)
func (*RoleMembers) Read ¶ added in v0.5.0
func (r *RoleMembers) Read(key RoleMemberKey) (*RoleMember, error)
func (*RoleMembers) Update ¶ added in v0.5.0
func (r *RoleMembers) Update(key RoleMemberKey, membership RoleMember) (*RoleMember, error)
type SchemaPrivilege ¶ added in v0.5.0
SchemaPrivilege grants to Role on Database
CREATE|USAGE on public schema CREATE|CONNECT|TEMPORARY on database
func (SchemaPrivilege) Key ¶ added in v0.5.0
func (p SchemaPrivilege) Key() SchemaPrivilegeKey
type SchemaPrivilegeKey ¶ added in v0.5.0
type SchemaPrivileges ¶ added in v0.5.0
type SchemaPrivileges struct {
DbOpener DbOpener
}
func (*SchemaPrivileges) Create ¶ added in v0.5.0
func (r *SchemaPrivileges) Create(obj SchemaPrivilege) (*SchemaPrivilege, error)
func (*SchemaPrivileges) Drop ¶ added in v0.5.0
func (r *SchemaPrivileges) Drop(key SchemaPrivilegeKey) (bool, error)
func (*SchemaPrivileges) Read ¶ added in v0.5.0
func (r *SchemaPrivileges) Read(key SchemaPrivilegeKey) (*SchemaPrivilege, error)
func (*SchemaPrivileges) Update ¶ added in v0.5.0
func (r *SchemaPrivileges) Update(key SchemaPrivilegeKey, obj SchemaPrivilege) (*SchemaPrivilege, error)
type Store ¶ added in v0.5.0
type Store struct { Databases *Databases Roles *Roles RoleMembers *RoleMembers DefaultGrants *DefaultGrants SchemaPrivileges *SchemaPrivileges sync.Mutex // contains filtered or unexported fields }
func (*Store) ConnectionUrl ¶ added in v0.6.0
Click to show internal directories.
Click to hide internal directories.