Documentation ¶
Overview ¶
Package role provides functions for managing PostgreSQL roles, including creating, updating, retrieving, and deleting roles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRoleNotFound = fmt.Errorf("role not found")
ErrRoleNotFound is returned when a requested role does not exist in the database.
Functions ¶
func Create ¶
Create adds a new PostgreSQL role to the database based on the provided Role struct. It returns an error if role already exists or the creation process fails
Types ¶
type Role ¶
type Role struct { // Name is the name of the role. Name string `json:"rolname"` // Superuser indicates whether the role has superuser privileges. Superuser bool `json:"rolsuper"` // Inherit indicates whether the role inherits privileges from its parent roles. Inherit bool `json:"rolinherit"` // CreateRole indicates whether the role can create other roles. CreateRole bool `json:"rolcreaterole"` // CreateDB indicates whether the role can create databases. CreateDB bool `json:"rolcreatedb"` // CanLogin indicates whether the role can log in (applicable to user roles). CanLogin bool `json:"rolcanlogin"` // Replication indicates whether the role can replicate data. Replication bool `json:"rolreplication"` // ConnLimit is the maximum number of concurrent connections allowed for the role. ConnLimit int `json:"rolconnlimit"` // Password is the password hash (masked for security). Password string `json:"rolpassword"` // ValidUntil is the password expiry date (nullable). ValidUntil pgtype.Timestamptz `json:"rolvaliduntil"` // BypassRLS indicates whether the role can bypass row-level security policies. BypassRLS bool `json:"rolbypassrls"` // Config is an array of configuration settings for the role. Config []string `json:"rolconfig"` // OID is the object identifier (OID) of the role. OID uint32 `json:"oid"` }
Role represents a PostgreSQL role with its associated attributes and privileges.
Click to show internal directories.
Click to hide internal directories.