datastore

package
v0.53.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// The Unique ID for the table.
	AppID uuid.UUID
	// The unique application External ID to be given to outside callers.
	AppExtlID string
	// The Foreign key for the organization that the app belongs to.
	OrgID uuid.UUID
	// The application name is a short name for the application.
	AppName string
	// The application description is several sentences to describe the application.
	AppDescription string
	// unique identifier representing authorization provider (e.g. Google, Github, etc.)
	AuthProviderID sql.NullInt32
	// Unique identifer of client ID given by an authentication provider. For example, GCP supports cross-client identity - see https://developers.google.com/identity/protocols/oauth2/cross-client-identity for a great explanation.
	AuthProviderClientID sql.NullString
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

app stores data about applications that interact with the system

type AppApiKey

type AppApiKey struct {
	// app_key is a hash of a key given to an person for an app
	ApiKey string
	// foreign key to app table
	AppID           uuid.UUID
	DeactvDate      time.Time
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type Auth

type Auth struct {
	// The unique id given to the authorization.
	AuthID uuid.UUID
	UserID uuid.UUID
	// Unique ID given to an authorization provider.
	AuthProviderID int64
	// Unique code given to an authorization provider (e.g. google).
	AuthProviderCd string
	// External ID (given by authorization provider) which represents the Oauth2 client which authenticated the user
	AuthProviderClientID sql.NullString
	// Unique ID given by the authorization provider which represents the person.
	AuthProviderPersonID string
	// Oauth2 access token given by the authorization provider.
	AuthProviderAccessToken string
	// OAuth2 refresh token given by the authorization provider.
	AuthProviderRefreshToken sql.NullString
	// Expiration of access token given by the authorization provider. Is not a perfect precision instrument as some providers do not give an exact time, but rather seconds until expiration, which means the value is calculated relative to the server time.
	AuthProviderAccessTokenExpiry time.Time
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The auth table stores which user has authenticated through an Oauth2 provider.

type AuthProvider

type AuthProvider struct {
	// Unique ID representing the authentication provider.
	AuthProviderID int64
	// Short code representing the authentication provider (e.g., google, github, apple, etc.)
	AuthProviderCd string
	// Longer description of authentication provider
	AuthProviderDesc string
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

Authentication Provider (e.g. Google, Github, Apple, Facebook, etc.)

type CreateAppAPIKeyParams

type CreateAppAPIKeyParams struct {
	ApiKey          string
	AppID           uuid.UUID
	DeactvDate      time.Time
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateAppParams

type CreateAppParams struct {
	AppID                uuid.UUID
	OrgID                uuid.UUID
	AppExtlID            string
	AppName              string
	AppDescription       string
	AuthProviderID       sql.NullInt32
	AuthProviderClientID sql.NullString
	CreateAppID          uuid.UUID
	CreateUserID         uuid.NullUUID
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateUserID         uuid.NullUUID
	UpdateTimestamp      time.Time
}

type CreateAuthParams

type CreateAuthParams struct {
	AuthID                        uuid.UUID
	UserID                        uuid.UUID
	AuthProviderID                int64
	AuthProviderCd                string
	AuthProviderClientID          sql.NullString
	AuthProviderPersonID          string
	AuthProviderAccessToken       string
	AuthProviderRefreshToken      sql.NullString
	AuthProviderAccessTokenExpiry time.Time
	CreateAppID                   uuid.UUID
	CreateUserID                  uuid.NullUUID
	CreateTimestamp               time.Time
	UpdateAppID                   uuid.UUID
	UpdateUserID                  uuid.NullUUID
	UpdateTimestamp               time.Time
}

type CreateAuthProviderParams

type CreateAuthProviderParams struct {
	AuthProviderID   int64
	AuthProviderCd   string
	AuthProviderDesc string
	CreateAppID      uuid.UUID
	CreateUserID     uuid.NullUUID
	CreateTimestamp  time.Time
	UpdateAppID      uuid.UUID
	UpdateUserID     uuid.NullUUID
	UpdateTimestamp  time.Time
}

type CreateMovieParams

type CreateMovieParams struct {
	MovieID         uuid.UUID
	ExtlID          string
	Title           string
	Rated           sql.NullString
	Released        sql.NullTime
	RunTime         sql.NullInt32
	Director        sql.NullString
	Writer          sql.NullString
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateOrgKindParams

type CreateOrgKindParams struct {
	OrgKindID       uuid.UUID
	OrgKindExtlID   string
	OrgKindDesc     string
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateOrgParams

type CreateOrgParams struct {
	OrgID           uuid.UUID
	OrgExtlID       string
	OrgName         string
	OrgDescription  string
	OrgKindID       uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreatePermissionParams

type CreatePermissionParams struct {
	PermissionID          uuid.UUID
	PermissionExtlID      string
	Resource              string
	Operation             string
	PermissionDescription string
	Active                bool
	CreateAppID           uuid.UUID
	CreateUserID          uuid.NullUUID
	CreateTimestamp       time.Time
	UpdateAppID           uuid.UUID
	UpdateUserID          uuid.NullUUID
	UpdateTimestamp       time.Time
}

type CreatePersonParams

type CreatePersonParams struct {
	PersonID        uuid.UUID
	PersonExtlID    string
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateRoleParams

type CreateRoleParams struct {
	RoleID          uuid.UUID
	RoleExtlID      string
	RoleCd          string
	RoleDescription string
	Active          bool
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateRolePermissionParams

type CreateRolePermissionParams struct {
	RoleID          uuid.UUID
	PermissionID    uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateUserLanguagePreferenceParams

type CreateUserLanguagePreferenceParams struct {
	UserID          uuid.UUID
	LanguageTag     string
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateUserParams

type CreateUserParams struct {
	UserID          uuid.UUID
	UserExtlID      string
	PersonID        uuid.UUID
	NamePrefix      sql.NullString
	FirstName       string
	MiddleName      sql.NullString
	LastName        string
	NameSuffix      sql.NullString
	Nickname        sql.NullString
	Email           sql.NullString
	CompanyName     sql.NullString
	CompanyDept     sql.NullString
	JobTitle        sql.NullString
	BirthDate       sql.NullTime
	BirthYear       sql.NullInt64
	BirthMonth      sql.NullInt64
	BirthDay        sql.NullInt64
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateUsersOrgParams

type CreateUsersOrgParams struct {
	UsersOrgID      uuid.UUID
	OrgID           uuid.UUID
	UserID          uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateUsersRoleParams

type CreateUsersRoleParams struct {
	UserID          uuid.UUID
	RoleID          uuid.UUID
	OrgID           uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type FindAppAPIKeysByAppExtlIDRow

type FindAppAPIKeysByAppExtlIDRow struct {
	AppID          uuid.UUID
	AppExtlID      string
	AppName        string
	AppDescription string
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	ApiKey         string
	DeactvDate     time.Time
}

type FindAppByExternalIDRow

type FindAppByExternalIDRow struct {
	AppID          uuid.UUID
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
	AppExtlID      string
	AppName        string
	AppDescription string
}

type FindAppByExternalIDWithAuditRow

type FindAppByExternalIDWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	AppID                uuid.UUID
	AppExtlID            string
	AppName              string
	AppDescription       string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  sql.NullString
	CreateUserLastName   sql.NullString
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  sql.NullString
	UpdateUserLastName   sql.NullString
	UpdateTimestamp      time.Time
}

type FindAppByIDRow

type FindAppByIDRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
	AppID          uuid.UUID
	AppExtlID      string
	AppName        string
	AppDescription string
}

type FindAppByIDWithAuditRow

type FindAppByIDWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	AppID                uuid.UUID
	AppExtlID            string
	AppName              string
	AppDescription       string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  sql.NullString
	CreateUserLastName   sql.NullString
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  sql.NullString
	UpdateUserLastName   sql.NullString
	UpdateTimestamp      time.Time
}

type FindAppByNameParams

type FindAppByNameParams struct {
	OrgID   uuid.UUID
	AppName string
}

type FindAppByNameRow

type FindAppByNameRow struct {
	AppID          uuid.UUID
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
	AppExtlID      string
	AppName        string
	AppDescription string
}

type FindAppByProviderClientIDRow

type FindAppByProviderClientIDRow struct {
	AppID          uuid.UUID
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
	AppExtlID      string
	AppName        string
	AppDescription string
}

type FindAppsWithAuditRow

type FindAppsWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	AppID                uuid.UUID
	AppExtlID            string
	AppName              string
	AppDescription       string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  sql.NullString
	CreateUserLastName   sql.NullString
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  sql.NullString
	UpdateUserLastName   sql.NullString
	UpdateTimestamp      time.Time
}

type FindAuthByProviderUserIDParams

type FindAuthByProviderUserIDParams struct {
	AuthProviderID       int64
	AuthProviderPersonID string
}

type FindMovieByExternalIDWithAuditRow

type FindMovieByExternalIDWithAuditRow struct {
	MovieID              uuid.UUID
	ExtlID               string
	Title                string
	Rated                sql.NullString
	Released             sql.NullTime
	RunTime              sql.NullInt32
	Director             sql.NullString
	Writer               sql.NullString
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  sql.NullString
	CreateUserLastName   sql.NullString
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  sql.NullString
	UpdateUserLastName   sql.NullString
	UpdateTimestamp      time.Time
}

type FindMoviesRow

type FindMoviesRow struct {
	MovieID              uuid.UUID
	ExtlID               string
	Title                string
	Rated                sql.NullString
	Released             sql.NullTime
	RunTime              sql.NullInt32
	Director             sql.NullString
	Writer               sql.NullString
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  sql.NullString
	CreateUserLastName   sql.NullString
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  sql.NullString
	UpdateUserLastName   sql.NullString
	UpdateTimestamp      time.Time
}

type FindOrgByExtlIDRow

type FindOrgByExtlIDRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
}

type FindOrgByExtlIDWithAuditRow

type FindOrgByExtlIDWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  string
	CreateUserLastName   string
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  string
	UpdateUserLastName   string
	UpdateTimestamp      time.Time
}

type FindOrgByIDRow

type FindOrgByIDRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
}

type FindOrgByIDWithAuditRow

type FindOrgByIDWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  string
	CreateUserLastName   string
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  string
	UpdateUserLastName   string
	UpdateTimestamp      time.Time
}

type FindOrgByNameRow

type FindOrgByNameRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
}

type FindOrgByNameWithAuditRow

type FindOrgByNameWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  string
	CreateUserLastName   string
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  string
	UpdateUserLastName   string
	UpdateTimestamp      time.Time
}

type FindOrgsByKindExtlIDRow

type FindOrgsByKindExtlIDRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindExtlID  string
	OrgKindDesc    string
}

type FindOrgsRow

type FindOrgsRow struct {
	OrgID          uuid.UUID
	OrgExtlID      string
	OrgName        string
	OrgDescription string
	OrgKindID      uuid.UUID
	OrgKindExtlID  string
	OrgKindDesc    string
}

type FindOrgsWithAuditRow

type FindOrgsWithAuditRow struct {
	OrgID                uuid.UUID
	OrgExtlID            string
	OrgName              string
	OrgDescription       string
	OrgKindID            uuid.UUID
	OrgKindExtlID        string
	OrgKindDesc          string
	CreateAppID          uuid.UUID
	CreateAppOrgID       uuid.UUID
	CreateAppExtlID      string
	CreateAppName        string
	CreateAppDescription string
	CreateUserID         uuid.NullUUID
	CreateUserFirstName  string
	CreateUserLastName   string
	CreateTimestamp      time.Time
	UpdateAppID          uuid.UUID
	UpdateAppOrgID       uuid.UUID
	UpdateAppExtlID      string
	UpdateAppName        string
	UpdateAppDescription string
	UpdateUserID         uuid.NullUUID
	UpdateUserFirstName  string
	UpdateUserLastName   string
	UpdateTimestamp      time.Time
}

type FindPermissionByResourceOperationParams

type FindPermissionByResourceOperationParams struct {
	Resource  string
	Operation string
}

type FindPersonByUserExternalIDRow

type FindPersonByUserExternalIDRow struct {
	PersonID     uuid.UUID
	PersonExtlID string
	UserID       uuid.UUID
	UserExtlID   string
	NamePrefix   sql.NullString
	FirstName    string
	MiddleName   sql.NullString
	LastName     string
	NameSuffix   sql.NullString
	Nickname     sql.NullString
	Email        sql.NullString
	CompanyName  sql.NullString
	CompanyDept  sql.NullString
	JobTitle     sql.NullString
	BirthDate    sql.NullTime
	BirthYear    sql.NullInt64
	BirthMonth   sql.NullInt64
	BirthDay     sql.NullInt64
}

type FindPersonByUserIDRow

type FindPersonByUserIDRow struct {
	PersonID     uuid.UUID
	PersonExtlID string
	UserID       uuid.UUID
	UserExtlID   string
	NamePrefix   sql.NullString
	FirstName    string
	MiddleName   sql.NullString
	LastName     string
	NameSuffix   sql.NullString
	Nickname     sql.NullString
	Email        sql.NullString
	CompanyName  sql.NullString
	CompanyDept  sql.NullString
	JobTitle     sql.NullString
	BirthDate    sql.NullTime
	BirthYear    sql.NullInt64
	BirthMonth   sql.NullInt64
	BirthDay     sql.NullInt64
}

type FindUsersByOrgRoleParams

type FindUsersByOrgRoleParams struct {
	OrgID  uuid.UUID
	RoleID uuid.UUID
}

type IsAuthorizedParams

type IsAuthorizedParams struct {
	Resource  string
	Operation string
	UserID    uuid.UUID
	OrgID     uuid.UUID
}

type Movie

type Movie struct {
	// The unique ID given to the movie.
	MovieID uuid.UUID
	// A unique ID given to the movie which can be used externally.
	ExtlID string
	// The title of the movie.
	Title string
	// The movie rating (PG, PG-13, R, etc.)
	Rated sql.NullString
	// The date the movie was released.
	Released sql.NullTime
	// The movie run time in minutes.
	RunTime sql.NullInt32
	// The movie director.
	Director sql.NullString
	// The movie writer.
	Writer sql.NullString
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The movie table stores details about a movie.

type Org

type Org struct {
	// Organization ID - Unique ID for table
	OrgID uuid.UUID
	// Organization Unique External ID to be given to outside callers.
	OrgExtlID string
	// Organization Name - a short name for the organization
	OrgName string
	// Organization Description - several sentences to describe the organization
	OrgDescription string
	// Foreign Key to org_kind table.
	OrgKindID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

type OrgKind

type OrgKind struct {
	// Organization Kind ID - pk for table
	OrgKindID uuid.UUID
	// A short code denoting the organization kind
	OrgKindExtlID string
	// A longer descriptor of the organization kind
	OrgKindDesc string
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

Organization Kind is a reference table denoting an organization's (org) classification. Examples are Genesis, Test, Standard

type Permission

type Permission struct {
	// The unique ID for the table.
	PermissionID uuid.UUID
	// Unique External ID to be given to outside callers.
	PermissionExtlID string
	// A human-readable string which represents a resource (e.g. an HTTP route or document, etc.).
	Resource string
	// A string representing the action taken on the resource (e.g. POST, GET, edit, etc.)
	Operation string
	// A description of what the permission is granting, e.g. "grants ability to edit a billing document".
	PermissionDescription string
	// A boolean denoting whether the permission is active (true) or not (false).
	Active bool
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The permission table stores an approval of a mode of access to a resource.

type Person

type Person struct {
	// The user ID is the unique ID for user (pk for table)
	PersonID uuid.UUID
	// The unique user external ID to be given to outside callers.
	PersonExtlID string
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateApp

func (q *Queries) CreateApp(ctx context.Context, arg CreateAppParams) (int64, error)

CreateApp inserts a new app into the app table.

func (*Queries) CreateAppAPIKey

func (q *Queries) CreateAppAPIKey(ctx context.Context, arg CreateAppAPIKeyParams) (int64, error)

CreateAppAPIKey inserts an app API key into the app_api_key table.

func (*Queries) CreateAuth

func (q *Queries) CreateAuth(ctx context.Context, arg CreateAuthParams) (int64, error)

func (*Queries) CreateAuthProvider

func (q *Queries) CreateAuthProvider(ctx context.Context, arg CreateAuthProviderParams) (int64, error)

func (*Queries) CreateMovie

func (q *Queries) CreateMovie(ctx context.Context, arg CreateMovieParams) (pgconn.CommandTag, error)

func (*Queries) CreateOrg

func (q *Queries) CreateOrg(ctx context.Context, arg CreateOrgParams) (int64, error)

func (*Queries) CreateOrgKind

func (q *Queries) CreateOrgKind(ctx context.Context, arg CreateOrgKindParams) (int64, error)

func (*Queries) CreatePermission

func (q *Queries) CreatePermission(ctx context.Context, arg CreatePermissionParams) (int64, error)

func (*Queries) CreatePerson

func (q *Queries) CreatePerson(ctx context.Context, arg CreatePersonParams) (int64, error)

func (*Queries) CreateRole

func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) (int64, error)

func (*Queries) CreateRolePermission

func (q *Queries) CreateRolePermission(ctx context.Context, arg CreateRolePermissionParams) (int64, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (int64, error)

func (*Queries) CreateUserLanguagePreference

func (q *Queries) CreateUserLanguagePreference(ctx context.Context, arg CreateUserLanguagePreferenceParams) (int64, error)

func (*Queries) CreateUsersOrg

func (q *Queries) CreateUsersOrg(ctx context.Context, arg CreateUsersOrgParams) (int64, error)

func (*Queries) CreateUsersRole

func (q *Queries) CreateUsersRole(ctx context.Context, arg CreateUsersRoleParams) (int64, error)

func (*Queries) DeleteAllPermissions4Role

func (q *Queries) DeleteAllPermissions4Role(ctx context.Context, roleID uuid.UUID) (int64, error)

func (*Queries) DeleteApp

func (q *Queries) DeleteApp(ctx context.Context, appID uuid.UUID) (int64, error)

DeleteApp deletes an app given its app_id.

func (*Queries) DeleteAppAPIKey

func (q *Queries) DeleteAppAPIKey(ctx context.Context, apiKey string) (int64, error)

DeleteAppAPIKey deletes an app API key given the key.

func (*Queries) DeleteAppAPIKeys

func (q *Queries) DeleteAppAPIKeys(ctx context.Context, appID uuid.UUID) (int64, error)

DeleteAppAPIKeys deletes all API keys for a given app_id.

func (*Queries) DeleteMovie

func (q *Queries) DeleteMovie(ctx context.Context, movieID uuid.UUID) (int64, error)

func (*Queries) DeleteOrg

func (q *Queries) DeleteOrg(ctx context.Context, orgID uuid.UUID) (int64, error)

func (*Queries) DeletePermissionByExternalID

func (q *Queries) DeletePermissionByExternalID(ctx context.Context, permissionExtlID string) (int64, error)

func (*Queries) DeletePerson

func (q *Queries) DeletePerson(ctx context.Context, personID uuid.UUID) (int64, error)

func (*Queries) DeleteUserByID

func (q *Queries) DeleteUserByID(ctx context.Context, userID uuid.UUID) (int64, error)

func (*Queries) DeleteUserLanguagePreferences

func (q *Queries) DeleteUserLanguagePreferences(ctx context.Context, userID uuid.UUID) (int64, error)

func (*Queries) FindAPIKeysByAppID

func (q *Queries) FindAPIKeysByAppID(ctx context.Context, appID uuid.UUID) ([]AppApiKey, error)

FindAPIKeysByAppID selects all API keys for a given app_id.

func (*Queries) FindAllPermissions

func (q *Queries) FindAllPermissions(ctx context.Context) ([]Permission, error)

func (*Queries) FindAppAPIKeysByAppExtlID

func (q *Queries) FindAppAPIKeysByAppExtlID(ctx context.Context, appExtlID string) ([]FindAppAPIKeysByAppExtlIDRow, error)

FindAppAPIKeysByAppExtlID selects all app API keys given an app external ID.

func (*Queries) FindAppByExternalID

func (q *Queries) FindAppByExternalID(ctx context.Context, appExtlID string) (FindAppByExternalIDRow, error)

FindAppByExternalID selects an app given its app_extl_id.

func (*Queries) FindAppByExternalIDWithAudit

func (q *Queries) FindAppByExternalIDWithAudit(ctx context.Context, appExtlID string) (FindAppByExternalIDWithAuditRow, error)

FindAppByExternalID selects an app given its app_extl_id. FindAppByExternalID also includes audit information as part of the return.

func (*Queries) FindAppByID

func (q *Queries) FindAppByID(ctx context.Context, appID uuid.UUID) (FindAppByIDRow, error)

FindAppByID selects an app given its app_id.

func (*Queries) FindAppByIDWithAudit

func (q *Queries) FindAppByIDWithAudit(ctx context.Context, appID uuid.UUID) (FindAppByIDWithAuditRow, error)

FindAppByID selects an app given its app_id. FindAppByID also includes audit information as part of the return.

func (*Queries) FindAppByName

func (q *Queries) FindAppByName(ctx context.Context, arg FindAppByNameParams) (FindAppByNameRow, error)

FindAppByName selects an app given its app_name.

func (*Queries) FindAppByProviderClientID

func (q *Queries) FindAppByProviderClientID(ctx context.Context, authProviderClientID sql.NullString) (FindAppByProviderClientIDRow, error)

FindAppByProviderClientID selects an app given an external auth provider client ID.

func (*Queries) FindApps

func (q *Queries) FindApps(ctx context.Context) ([]App, error)

FindApps returns every app.

func (*Queries) FindAppsByOrg

func (q *Queries) FindAppsByOrg(ctx context.Context, orgID uuid.UUID) ([]App, error)

FindAppsByOrg returns all apps for a given Organization.

func (*Queries) FindAppsWithAudit

func (q *Queries) FindAppsWithAudit(ctx context.Context) ([]FindAppsWithAuditRow, error)

FindAppsWithAudit returns every app. FindAppsWithAudit also includes audit information as part of the return.

func (*Queries) FindAuthByAccessToken

func (q *Queries) FindAuthByAccessToken(ctx context.Context, authProviderAccessToken string) (Auth, error)

func (*Queries) FindAuthByProviderUserID

func (q *Queries) FindAuthByProviderUserID(ctx context.Context, arg FindAuthByProviderUserIDParams) (Auth, error)

func (*Queries) FindMovieByExternalID

func (q *Queries) FindMovieByExternalID(ctx context.Context, extlID string) (Movie, error)

func (*Queries) FindMovieByExternalIDWithAudit

func (q *Queries) FindMovieByExternalIDWithAudit(ctx context.Context, extlID string) (FindMovieByExternalIDWithAuditRow, error)

func (*Queries) FindMovies

func (q *Queries) FindMovies(ctx context.Context) ([]FindMoviesRow, error)

func (*Queries) FindMoviesByTitle

func (q *Queries) FindMoviesByTitle(ctx context.Context, title string) ([]Movie, error)

func (*Queries) FindOrgByExtlID

func (q *Queries) FindOrgByExtlID(ctx context.Context, orgExtlID string) (FindOrgByExtlIDRow, error)

func (*Queries) FindOrgByExtlIDWithAudit

func (q *Queries) FindOrgByExtlIDWithAudit(ctx context.Context, orgExtlID string) (FindOrgByExtlIDWithAuditRow, error)

func (*Queries) FindOrgByID

func (q *Queries) FindOrgByID(ctx context.Context, orgID uuid.UUID) (FindOrgByIDRow, error)

func (*Queries) FindOrgByIDWithAudit

func (q *Queries) FindOrgByIDWithAudit(ctx context.Context, orgID uuid.UUID) (FindOrgByIDWithAuditRow, error)

func (*Queries) FindOrgByName

func (q *Queries) FindOrgByName(ctx context.Context, orgName string) (FindOrgByNameRow, error)

func (*Queries) FindOrgByNameWithAudit

func (q *Queries) FindOrgByNameWithAudit(ctx context.Context, orgName string) (FindOrgByNameWithAuditRow, error)

func (*Queries) FindOrgKindByExtlID

func (q *Queries) FindOrgKindByExtlID(ctx context.Context, orgKindExtlID string) (OrgKind, error)

func (*Queries) FindOrgKinds

func (q *Queries) FindOrgKinds(ctx context.Context) ([]OrgKind, error)

--------------------------------------------------------------------------------------------------------------------- Org Kind ---------------------------------------------------------------------------------------------------------------------

func (*Queries) FindOrgs

func (q *Queries) FindOrgs(ctx context.Context) ([]FindOrgsRow, error)

func (*Queries) FindOrgsByKindExtlID

func (q *Queries) FindOrgsByKindExtlID(ctx context.Context, orgKindExtlID string) ([]FindOrgsByKindExtlIDRow, error)

func (*Queries) FindOrgsWithAudit

func (q *Queries) FindOrgsWithAudit(ctx context.Context) ([]FindOrgsWithAuditRow, error)

func (*Queries) FindPermissionByExternalID

func (q *Queries) FindPermissionByExternalID(ctx context.Context, permissionExtlID string) (Permission, error)

func (*Queries) FindPermissionByResourceOperation

func (q *Queries) FindPermissionByResourceOperation(ctx context.Context, arg FindPermissionByResourceOperationParams) (Permission, error)

func (*Queries) FindPersonByUserExternalID

func (q *Queries) FindPersonByUserExternalID(ctx context.Context, userExtlID string) (FindPersonByUserExternalIDRow, error)

func (*Queries) FindPersonByUserID

func (q *Queries) FindPersonByUserID(ctx context.Context, userID uuid.UUID) (FindPersonByUserIDRow, error)

func (*Queries) FindRoleByCode

func (q *Queries) FindRoleByCode(ctx context.Context, roleCd string) (Role, error)

func (*Queries) FindRolePermissionsByRoleID

func (q *Queries) FindRolePermissionsByRoleID(ctx context.Context, roleID uuid.UUID) ([]Permission, error)

func (*Queries) FindUserByExternalID

func (q *Queries) FindUserByExternalID(ctx context.Context, userExtlID string) (User, error)

func (*Queries) FindUserByID

func (q *Queries) FindUserByID(ctx context.Context, userID uuid.UUID) (User, error)

func (*Queries) FindUserLanguagePreferencesByUserID

func (q *Queries) FindUserLanguagePreferencesByUserID(ctx context.Context, userID uuid.UUID) ([]UsersLangPref, error)

func (*Queries) FindUsersByOrgRole

func (q *Queries) FindUsersByOrgRole(ctx context.Context, arg FindUsersByOrgRoleParams) ([]UsersRole, error)

func (*Queries) IsAuthorized

func (q *Queries) IsAuthorized(ctx context.Context, arg IsAuthorizedParams) (uuid.UUID, error)

IsAuthorized selects a user_id which is authorized for access to a resource. The query can return multiple results, but since QueryRow is used, only the first is returned.

func (*Queries) UpdateApp

func (q *Queries) UpdateApp(ctx context.Context, arg UpdateAppParams) (int64, error)

UpdateApp updates an app given its app_id.

func (*Queries) UpdateMovie

func (q *Queries) UpdateMovie(ctx context.Context, arg UpdateMovieParams) error

func (*Queries) UpdateOrg

func (q *Queries) UpdateOrg(ctx context.Context, arg UpdateOrgParams) (int64, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Role

type Role struct {
	// The unique ID for the table.
	RoleID uuid.UUID
	// Unique External ID to be given to outside callers.
	RoleExtlID string
	// A human-readable code which represents the role.
	RoleCd string
	// A longer description of the role.
	RoleDescription string
	// A boolean denoting whether the role is active (true) or not (false).
	Active bool
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The role table stores a job function or title which defines an authority level.

type RolePermission

type RolePermission struct {
	// The unique role which can have 1 to many permissions set in this table.
	RoleID uuid.UUID
	// The unique permission that is being given to the role.
	PermissionID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The role_permission table stores which roles have which permissions.

type UpdateAppParams

type UpdateAppParams struct {
	AppName         string
	AppDescription  string
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
	AppID           uuid.UUID
}

type UpdateMovieParams

type UpdateMovieParams struct {
	Title           string
	Rated           sql.NullString
	Released        sql.NullTime
	RunTime         sql.NullInt32
	Director        sql.NullString
	Writer          sql.NullString
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
	MovieID         uuid.UUID
}

type UpdateOrgParams

type UpdateOrgParams struct {
	OrgName         string
	OrgDescription  string
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
	OrgID           uuid.UUID
}

type User

type User struct {
	UserID     uuid.UUID
	UserExtlID string
	PersonID   uuid.UUID
	NamePrefix sql.NullString
	FirstName  string
	MiddleName sql.NullString
	LastName   string
	NameSuffix sql.NullString
	Nickname   sql.NullString
	// Primary email for the user
	Email           sql.NullString
	CompanyName     sql.NullString
	CompanyDept     sql.NullString
	JobTitle        sql.NullString
	BirthDate       sql.NullTime
	BirthYear       sql.NullInt64
	BirthMonth      sql.NullInt64
	BirthDay        sql.NullInt64
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

users stores data about users that interact with the system. A user is a person who utilizes a computer or network service." In the context of this project, given that we allow Persons to authenticate with multiple providers, a User is akin to a user (Wikipedia - "The word persona derives from Latin, where it originally referred to a theatrical mask. On the social web, users develop virtual personas as online identities.") and as such, a Person can have one to many Users (for instance, I can have a GitHub user and a Google user, but I am just one Person). As a general, practical matter, most operations are considered at the User level. For instance, roles are assigned at the user level instead of the Person level, which allows for more fine-grained access control. Architecture note: All tables are to be singular, however, because user is a reserved word, the rules are broken here. It is unfortunate, but the alternatives are no better.

type UsersLangPref

type UsersLangPref struct {
	// The user having a language tag preference.
	UserID uuid.UUID
	// The BCP 47 Language Tag which identifies a language both spoken and written.
	LanguageTag string
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The users_lang_prefs table stores the list of language tag preferences for the user.

type UsersOrg

type UsersOrg struct {
	// Unique identifier for a user's association with an organization
	UsersOrgID uuid.UUID
	// Organization ID foreign key to org table
	OrgID uuid.UUID
	// User ID foreign key to users table
	UserID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

type UsersRole

type UsersRole struct {
	// The user which is being given a role (within an organization).
	UserID uuid.UUID
	// The role which can have one to many users set in this table.
	RoleID uuid.UUID
	// The organization to which the role and user are associated.
	OrgID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The users_role table stores which users have which role(s) in which organization(s).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL