Documentation
¶
Index ¶
- Constants
- func Bootstrap(ctx context.Context, conn pg.PoolConn) error
- func GrantGroupMembership(ctx context.Context, conn pg.Conn, group, member string) error
- func RevokeGroupMembership(ctx context.Context, conn pg.Conn, group, member string) error
- type ACLItem
- func (acl ACLItem) GrantDatabase(ctx context.Context, conn pg.Conn, name string) error
- func (acl ACLItem) GrantSchema(ctx context.Context, conn pg.Conn, name string) error
- func (acl ACLItem) GrantTablespace(ctx context.Context, conn pg.Conn, name string) error
- func (acl ACLItem) IsAll() bool
- func (acl ACLItem) RevokeDatabase(ctx context.Context, conn pg.Conn, name string) error
- func (acl ACLItem) RevokeSchema(ctx context.Context, conn pg.Conn, name string) error
- func (acl ACLItem) RevokeTablespace(ctx context.Context, conn pg.Conn, name string) error
- func (a ACLItem) String() string
- func (acl *ACLItem) UnmarshalJSON(data []byte) error
- func (acl *ACLItem) UnmarshalText(data []byte) error
- func (a ACLItem) WithPriv(priv ...string) *ACLItem
- type ACLList
- type Connection
- type ConnectionList
- type ConnectionListRequest
- type ConnectionPid
- type Database
- type DatabaseList
- type DatabaseListRequest
- type DatabaseMeta
- type DatabaseName
- type Object
- type ObjectList
- type ObjectListRequest
- type ObjectMeta
- type ObjectName
- type Role
- type RoleList
- type RoleListRequest
- type RoleMeta
- type RoleName
- type Schema
- type SchemaList
- type SchemaListRequest
- type SchemaMeta
- type SchemaName
- type Tablespace
- type TablespaceList
- type TablespaceListRequest
- type TablespaceMeta
- type TablespaceName
Constants ¶
View Source
const ( // Maximum number of items to return in a list query, for each type RoleListLimit = 100 DatabaseListLimit = 100 SchemaListLimit = 100 ObjectListLimit = 100 ConnectionListLimit = 100 TablespaceListLimit = 100 )
View Source
const (
CatalogSchema = "pg_catalog"
)
View Source
const (
ObjectDef = `` /* 140-byte string literal not displayed */
)
View Source
const (
SchemaDef = `schema ("oid" OID, "database" TEXT, "name" TEXT, "owner" TEXT, "acl" TEXT[], "size" BIGINT)`
)
Variables ¶
This section is empty.
Functions ¶
func GrantGroupMembership ¶
Types ¶
type ACLItem ¶
type ACLItem struct {
Role string `json:"role,omitempty" help:"Role name"`
Priv []string `json:"priv,omitempty" help:"Access privileges"`
Grantor string `json:"-" help:"Grantor"` // Ignore field for now
}
func NewACLItem ¶
Create a new ACLItem from a postgresql ACL string
func ParseACLItem ¶
Parse an ACLItem from a command-line flag, like <role>:<priv>,<priv>,<priv>...
func (ACLItem) GrantDatabase ¶
Grant access privileges to a database
func (ACLItem) GrantSchema ¶
Grant access privileges to a schema
func (ACLItem) GrantTablespace ¶
Grant access privileges to a tablespace
func (ACLItem) RevokeDatabase ¶
Revoke access privileges to a database
func (ACLItem) RevokeSchema ¶
Revoke access privileges to a schema
func (ACLItem) RevokeTablespace ¶
Revoke access privileges to a tablespace
func (*ACLItem) UnmarshalJSON ¶
func (*ACLItem) UnmarshalText ¶
type ACLList ¶
type ACLList []*ACLItem
func (*ACLList) UnmarshalJSON ¶
func (*ACLList) UnmarshalText ¶
type Connection ¶
type Connection struct {
Pid uint32 `json:"pid" help:"Process ID"`
Database string `json:"database" help:"Database"`
Role string `json:"role" help:"Role"`
Application *string `json:"application,omitempty" help:"Application"`
ClientAddr string `json:"client_addr,omitempty" help:"Client address"`
ClientPort uint16 `json:"client_port,omitempty" help:"Client port"`
ConnStart time.Time `json:"conn_start,omitempty" help:"Connection start"`
QueryStart time.Time `json:"query_start,omitempty" help:"Query start"`
Query string `json:"query,omitempty" help:"Query"`
State string `json:"state,omitempty" help:"State"`
}
func (Connection) String ¶
func (c Connection) String() string
type ConnectionList ¶
type ConnectionList struct {
Count uint64 `json:"count"`
Body []Connection `json:"body,omitempty"`
}
func (ConnectionList) String ¶
func (c ConnectionList) String() string
type ConnectionListRequest ¶
type ConnectionListRequest struct {
pg.OffsetLimit
Database *string `json:"database,omitempty" help:"Database"`
Role *string `json:"role,omitempty" help:"Role"`
State *string `json:"state,omitempty" help:"State"`
}
func (ConnectionListRequest) String ¶
func (c ConnectionListRequest) String() string
type ConnectionPid ¶
type ConnectionPid uint64
type Database ¶
type Database struct {
Oid uint32 `json:"oid"`
DatabaseMeta
Size uint64 `json:"bytes,omitempty" help:"Size of database in bytes"`
}
type DatabaseList ¶
func (DatabaseList) String ¶
func (d DatabaseList) String() string
type DatabaseListRequest ¶
type DatabaseListRequest struct {
pg.OffsetLimit
}
func (DatabaseListRequest) String ¶
func (d DatabaseListRequest) String() string
type DatabaseMeta ¶
type DatabaseMeta struct {
Name string `json:"name,omitempty" arg:"" help:"Name"`
Owner string `json:"owner,omitempty" help:"Owner"`
Acl ACLList `json:"acl,omitempty" help:"Access privileges"`
}
func (DatabaseMeta) String ¶
func (d DatabaseMeta) String() string
type DatabaseName ¶
type DatabaseName string
type Object ¶
type Object struct {
Oid uint32 `json:"oid"`
Database string `json:"database,omitempty" help:"Database"`
Schema string `json:"schema,omitempty" help:"Schema"`
Type string `json:"type,omitempty" help:"Type"`
ObjectMeta
Tablespace *string `json:"tablespace,omitempty" help:"Tablespace"`
Size uint64 `json:"bytes,omitempty" help:"Size of object in bytes"`
}
type ObjectList ¶
func (ObjectList) String ¶
func (o ObjectList) String() string
type ObjectListRequest ¶
type ObjectListRequest struct {
Database *string `json:"database,omitempty" help:"Database"`
Schema *string `json:"schema,omitempty" help:"Schema"`
Type *string `json:"type,omitempty" help:"Object Type"`
pg.OffsetLimit
}
func (ObjectListRequest) String ¶
func (o ObjectListRequest) String() string
type ObjectMeta ¶
type ObjectMeta struct {
Name string `json:"name,omitempty" arg:"" help:"Name"`
Owner string `json:"owner,omitempty" help:"Owner"`
Acl []*ACLItem `json:"acl,omitempty" help:"Access privileges"`
}
func (ObjectMeta) String ¶
func (o ObjectMeta) String() string
type ObjectName ¶
type ObjectName struct {
Schema string `json:"schema,omitempty" help:"Schema"`
Name string `json:"name,omitempty" arg:"" help:"Name"`
}
func (ObjectName) String ¶
func (o ObjectName) String() string
type RoleListRequest ¶
type RoleListRequest struct {
pg.OffsetLimit
}
func (RoleListRequest) String ¶
func (r RoleListRequest) String() string
type RoleMeta ¶
type RoleMeta struct {
Name string `json:"name,omitempty" arg:"" help:"Role name"`
Superuser *bool `json:"super,omitempty" help:"Superuser permission"`
Inherit *bool `json:"inherit,omitempty" help:"Inherit permissions"`
CreateRoles *bool `json:"createrole,omitempty" help:"Create roles permission"`
CreateDatabases *bool `json:"createdb,omitempty" help:"Create databases permission"`
Replication *bool `json:"replication,omitempty" help:"Replication permission"`
ConnectionLimit *uint64 `json:"conlimit,omitempty" help:"Connection limit"`
BypassRowLevelSecurity *bool `json:"bypassrls,omitempty" help:"Bypass row-level security"`
Login *bool `json:"login,omitempty" help:"Login permission"`
Password *string `json:"password,omitempty" help:"Password"`
Expires *time.Time `json:"expires,omitzero" help:"Password expiration"`
Groups []string `json:"memberof,omitempty" help:"Group memberships"`
}
type Schema ¶
type Schema struct {
Oid uint32 `json:"oid"`
Database string `json:"database,omitempty" help:"Database"`
SchemaMeta
Size uint64 `json:"bytes,omitempty" help:"Size of schema in bytes"`
}
type SchemaList ¶
func (SchemaList) String ¶
func (s SchemaList) String() string
type SchemaListRequest ¶
type SchemaListRequest struct {
Database *string `json:"database,omitempty" help:"Database"`
pg.OffsetLimit
}
func (SchemaListRequest) String ¶
func (s SchemaListRequest) String() string
type SchemaMeta ¶
type SchemaMeta struct {
Name string `json:"name,omitempty" arg:"" help:"Name"`
Owner string `json:"owner,omitempty" help:"Owner"`
Acl ACLList `json:"acl,omitempty" help:"Access privileges"`
}
func (SchemaMeta) String ¶
func (s SchemaMeta) String() string
type SchemaName ¶
type SchemaName string
type Tablespace ¶
type Tablespace struct {
Oid uint32 `json:"oid"`
TablespaceMeta
Location string `json:"location,omitempty" help:"Location"`
Options []string `json:"options,omitempty" help:"Options"`
Size uint64 `json:"bytes,omitempty" help:"Size of schema in bytes"`
}
func (Tablespace) String ¶
func (t Tablespace) String() string
type TablespaceList ¶
type TablespaceList struct {
Count uint64 `json:"count"`
Body []Tablespace `json:"body,omitempty"`
}
func (TablespaceList) String ¶
func (t TablespaceList) String() string
type TablespaceListRequest ¶
type TablespaceListRequest struct {
pg.OffsetLimit
}
func (TablespaceListRequest) String ¶
func (t TablespaceListRequest) String() string
type TablespaceMeta ¶
type TablespaceMeta struct {
Name *string `json:"name,omitempty" help:"Tablespace name"`
Owner *string `json:"owner,omitempty" help:"Owner"`
Acl ACLList `json:"acl,omitempty" help:"Access privileges"`
}
func (TablespaceMeta) String ¶
func (t TablespaceMeta) String() string
Click to show internal directories.
Click to hide internal directories.