Documentation ¶
Overview ¶
Package principal provides principal-related logic
Index ¶
- Constants
- Variables
- func InsertPrincipalStatusTx(db *sql.Tx, pr Principal, createdBy string) error
- func InsertPrincipalTx(db *sql.Tx, p *Principal) error
- func PrincipalIDByNameTx(db *sql.Tx, name string) (int64, error)
- type Principal
- func PrincipalAllDB(db *sql.DB) ([]*Principal, error)
- func PrincipalByIDDB(db *sql.DB, id int64) (Principal, error)
- func PrincipalByIDTx(db *sql.Tx, id int64) (Principal, error)
- func PrincipalByNameDB(db *sql.DB, name string) (Principal, error)
- func PrincipalByNameTx(db *sql.Tx, name string) (Principal, error)
Constants ¶
View Source
const ( PrincipalStatusActive = "active" PrincipalStatusInactive = "inactive" PrincipalStatusDeleted = "deleted" )
View Source
const MetadataModel metadataModel = 0
representation of the metadata schema structure
Variables ¶
View Source
var ( ErrInvalidStatus = errors.New("invalid status") ErrPrincipalInactive = errors.New("principal is inactive") )
View Source
var ( // ErrPrincipalNotFound is an error which various select methods will return // if the requested principal was not found ErrPrincipalNotFound = errors.New("principal not found") )
Functions ¶
func InsertPrincipalStatusTx ¶
InsertPrincipalStatusTx adds a status entry for the given principal
func InsertPrincipalTx ¶
InsertPrincipalTx inserts a principal
This will modify the given principal, setting the ID field.
Types ¶
type Principal ¶
type Principal struct { ID int64 `json:",string"` Created time.Time CreatedBy string Name string `json:",omitempty"` Status string Metadata map[string]string }
Principal represents a principal
A principal is a resource under which projects are organized
func PrincipalByNameDB ¶
PrincipalByNameDB selects a principal by the given name
If no such principal exists, it will return an empty principal
func PrincipalByNameTx ¶
PrincipalByNameTx selects a principal by the given name
If no such principal exists, it will return an empty principal
func (Principal) ValidStatus ¶
ValidStatus returns an ErrInvalidStatus if the set status is considered invalid
Click to show internal directories.
Click to hide internal directories.