Documentation ¶
Overview ¶
Package org contains package methods for org support.
Index ¶
- Constants
- func Users(ctx context.Context, conn *pgx.Conn, id models.ID) ([]models.ID, error)
- type CreateEvent
- type Org
- func (o *Org) GetID() models.ID
- func (o *Org) GetOrg() models.ID
- func (o *Org) GetUser() models.ID
- func (o *Org) Insert(ctx context.Context, conn *pgx.Conn) error
- func (o *Org) Refresh(ctx context.Context, conn *pgx.Conn) error
- func (o *Org) UpdateOwner(ctx context.Context, conn *pgx.Conn, newOwner models.ID) error
- func (o *Org) UpdateStatus(ctx context.Context, conn *pgx.Conn, newStatus models.Status) error
- type UpdateOwnerEvent
- type UpdateStatusEvent
Constants ¶
View Source
const SchemaVersion = 0
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateEvent ¶
type CreateEvent struct { Name safe.VarChar `json:"name"` OwnerDisplayName safe.VarChar `json:"owner_display_name"` OwnerEmail safe.VarChar `json:"owner_email"` OwnerPassword safe.Password `json:"owner_password"` Role models.Role `json:"role"` // contains filtered or unexported fields }
func NewCreateEvent ¶
func NewCreateEvent(argon2Config *argon2.Config) (*CreateEvent, error)
func (*CreateEvent) UnmarshalJSON ¶
func (ev *CreateEvent) UnmarshalJSON(bs []byte) error
UnmarshalJSON assumes OwnerPassword is cleartext and hashes it with argon2. This minimizes the window to access the cleartext password accidentally.
type Org ¶
Org models a row of the orgs table.
func Create ¶
func Create( ctx context.Context, conn *pgx.Conn, name safe.VarChar, ownerDisplayName safe.VarChar, ownerEmail safe.VarChar, ownerPassword safe.Password, role models.Role, versionKey *security.VersionKey, ) (*Org, *user.User, error)
Create inserts a new org and org owner into the db.
func (*Org) Refresh ¶
Refresh will re-initialize data fields after an update, typically inside the same txn that performed the update.
func (*Org) UpdateOwner ¶
UpdateOwner assigns a new user in the org as the owner.
type UpdateOwnerEvent ¶
type UpdateStatusEvent ¶
Click to show internal directories.
Click to hide internal directories.