Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyBuildNumber defines the error type when a // Build type has an empty Number field provided. ErrEmptyBuildNumber = errors.New("empty build number provided") // ErrEmptyBuildRepoID defines the error type when a // Build type has an empty `RepoID` field provided. ErrEmptyBuildRepoID = errors.New("empty build repo_id provided") )
var ( // ErrEmptyDashName defines the error type when a // User type has an empty Name field provided. ErrEmptyDashName = errors.New("empty dashboard name provided") // ErrExceededAdminLimit defines the error type when a // User type has Admins field provided that exceeds the database limit. ErrExceededAdminLimit = errors.New("exceeded admins limit") )
var ( // ErrEmptyRepoFullName defines the error type when a // Repo type has an empty FullName field provided. ErrEmptyRepoFullName = errors.New("empty repo full_name provided") // ErrEmptyRepoHash defines the error type when a // Repo type has an empty Hash field provided. ErrEmptyRepoHash = errors.New("empty repo hash provided") // ErrEmptyRepoName defines the error type when a // Repo type has an empty Name field provided. ErrEmptyRepoName = errors.New("empty repo name provided") // ErrEmptyRepoOrg defines the error type when a // Repo type has an empty Org field provided. ErrEmptyRepoOrg = errors.New("empty repo org provided") // ErrEmptyRepoUserID defines the error type when a // Repo type has an empty UserID field provided. ErrEmptyRepoUserID = errors.New("empty repo user_id provided") // ErrEmptyRepoVisibility defines the error type when a // Repo type has an empty Visibility field provided. ErrEmptyRepoVisibility = errors.New("empty repo visibility provided") // ErrExceededTopicsLimit defines the error type when a // Repo type has Topics field provided that exceeds the database limit. ErrExceededTopicsLimit = errors.New("exceeded topics limit") )
var ( // ErrEmptyScheduleEntry defines the error type when a Schedule type has an empty Entry field provided. ErrEmptyScheduleEntry = errors.New("empty schedule entry provided") // ErrEmptyScheduleName defines the error type when a Schedule type has an empty Name field provided. ErrEmptyScheduleName = errors.New("empty schedule name provided") // ErrEmptyScheduleRepoID defines the error type when a Schedule type has an empty RepoID field provided. ErrEmptyScheduleRepoID = errors.New("empty schedule repo_id provided") // ErrInvalidScheduleEntry defines the error type when a Schedule type has an invalid Entry field provided. ErrInvalidScheduleEntry = errors.New("invalid schedule entry provided") )
var ( // ErrEmptyUserName defines the error type when a // User type has an empty Name field provided. ErrEmptyUserName = errors.New("empty user name provided") // ErrEmptyUserRefreshToken defines the error type when a // User type has an empty RefreshToken field provided. ErrEmptyUserRefreshToken = errors.New("empty user refresh token provided") // ErrEmptyUserToken defines the error type when a // User type has an empty Token field provided. ErrEmptyUserToken = errors.New("empty user token provided") // ErrInvalidUserName defines the error type when a // User type has an invalid Name field provided. ErrInvalidUserName = errors.New("invalid user name provided") // ErrExceededFavoritesLimit defines the error type when a // User type has Favorites field provided that exceeds the database limit. ErrExceededFavoritesLimit = errors.New("exceeded favorites limit") // ErrExceededDashboardsLimit defines the error type when a // User type has Dashboards field provided that exceeds the database limit. ErrExceededDashboardsLimit = errors.New("exceeded dashboards limit") )
var ( // ErrEmptyWorkerHost defines the error type when a // Worker type has an empty Host field provided. ErrEmptyWorkerHost = errors.New("empty worker hostname provided") // ErrEmptyWorkerAddress defines the error type when a // Worker type has an empty Address field provided. ErrEmptyWorkerAddress = errors.New("empty worker address provided") // ErrExceededRunningBuildIDsLimit defines the error type when a // Worker type has RunningBuildIDs field provided that exceeds the database limit. ErrExceededRunningBuildIDsLimit = errors.New("exceeded running build ids limit") )
var ( // ErrEmptyCloneImage defines the error type when a // Settings type has an empty CloneImage field provided. ErrEmptyCloneImage = errors.New("empty settings clone image provided") )
var ( // ErrInvalidKID defines the error type when a // JWK type has an invalid ID field provided. ErrInvalidKID = errors.New("invalid key identifier provided") )
Functions ¶
This section is empty.
Types ¶
type AdminsJSON ¶
func (*AdminsJSON) Scan ¶
func (a *AdminsJSON) Scan(value interface{}) error
Scan - Implement the database/sql scanner interface for AdminsJSON.
type Build ¶
type Build struct { ID sql.NullInt64 `sql:"id"` RepoID sql.NullInt64 `sql:"repo_id"` PipelineID sql.NullInt64 `sql:"pipeline_id"` Number sql.NullInt32 `sql:"number"` Parent sql.NullInt32 `sql:"parent"` Event sql.NullString `sql:"event"` EventAction sql.NullString `sql:"event_action"` Status sql.NullString `sql:"status"` Error sql.NullString `sql:"error"` Enqueued sql.NullInt64 `sql:"enqueued"` Created sql.NullInt64 `sql:"created"` Started sql.NullInt64 `sql:"started"` Finished sql.NullInt64 `sql:"finished"` Deploy sql.NullString `sql:"deploy"` DeployNumber sql.NullInt64 `sql:"deploy_number"` DeployPayload raw.StringSliceMap `sql:"deploy_payload" gorm:"type:varchar(2000)"` Clone sql.NullString `sql:"clone"` Source sql.NullString `sql:"source"` Title sql.NullString `sql:"title"` Message sql.NullString `sql:"message"` Commit sql.NullString `sql:"commit"` Sender sql.NullString `sql:"sender"` SenderSCMID sql.NullString `sql:"sender_scm_id"` Author sql.NullString `sql:"author"` Email sql.NullString `sql:"email"` Link sql.NullString `sql:"link"` Branch sql.NullString `sql:"branch"` Ref sql.NullString `sql:"ref"` BaseRef sql.NullString `sql:"base_ref"` HeadRef sql.NullString `sql:"head_ref"` Host sql.NullString `sql:"host"` Runtime sql.NullString `sql:"runtime"` Distribution sql.NullString `sql:"distribution"` ApprovedAt sql.NullInt64 `sql:"approved_at"` ApprovedBy sql.NullString `sql:"approved_by"` Repo Repo `gorm:"foreignKey:RepoID"` }
Build is the database representation of a build for a pipeline.
func BuildFromAPI ¶
BuildFromAPI converts the API Build type to a database build type.
func (*Build) Crop ¶
Crop prepares the Build type for inserting into the database by trimming values that may exceed the database column limit.
func (*Build) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Build type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type Compiler ¶
type Compiler struct { CloneImage sql.NullString `json:"clone_image" sql:"clone_image"` TemplateDepth sql.NullInt64 `json:"template_depth" sql:"template_depth"` StarlarkExecLimit sql.NullInt64 `json:"starlark_exec_limit" sql:"starlark_exec_limit"` }
Compiler is the database representation of compiler settings.
type DashReposJSON ¶
type DashReposJSON []*api.DashboardRepo
func (*DashReposJSON) Scan ¶
func (r *DashReposJSON) Scan(value interface{}) error
Scan - Implement the database/sql scanner interface for DashReposJSON.
type Dashboard ¶
type Dashboard struct { ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v7()"` Name sql.NullString `sql:"name"` CreatedAt sql.NullInt64 `sql:"created_at"` CreatedBy sql.NullString `sql:"created_by"` UpdatedAt sql.NullInt64 `sql:"updated_at"` UpdatedBy sql.NullString `sql:"updated_by"` Admins AdminsJSON Repos DashReposJSON }
Dashboard is the database representation of a dashboard.
func DashboardFromAPI ¶
DashboardFromAPI converts the API Dashboard type to a database Dashboard type.
func (*Dashboard) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Dashboard type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type JWK ¶
type JWK struct { ID uuid.UUID `gorm:"type:uuid"` Active sql.NullBool `sql:"active"` Key []byte `sql:"key"` }
JWK is the database representation of a jwk.
func JWKFromAPI ¶
func JWKFromAPI(j jwk.RSAPublicKey) *JWK
JWKFromAPI converts the API JWK type to a database JWK type.
func (*JWK) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the JWK type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
func (*JWK) ToAPI ¶
func (j *JWK) ToAPI() jwk.RSAPublicKey
ToAPI converts the JWK type to an API JWK type.
type Platform ¶
type Platform struct { ID sql.NullInt64 `sql:"id"` Compiler Queue RepoAllowlist pq.StringArray `json:"repo_allowlist" sql:"repo_allowlist" gorm:"type:varchar(1000)"` ScheduleAllowlist pq.StringArray `json:"schedule_allowlist" sql:"schedule_allowlist" gorm:"type:varchar(1000)"` CreatedAt sql.NullInt64 `sql:"created_at"` UpdatedAt sql.NullInt64 `sql:"updated_at"` UpdatedBy sql.NullString `sql:"updated_by"` }
Platform is the database representation of platform settings.
func SettingsFromAPI ¶
SettingsFromAPI converts the API Settings type to a database Settings type.
func (*Platform) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Settings type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type Queue ¶
type Queue struct {
Routes pq.StringArray `json:"routes" sql:"routes" gorm:"type:varchar(1000)"`
}
Queue is the database representation of queue settings.
type QueueBuild ¶
type QueueBuild struct { Status sql.NullString `sql:"status"` Number sql.NullInt32 `sql:"number"` Created sql.NullInt64 `sql:"created"` FullName sql.NullString `sql:"full_name"` }
QueueBuild is the database representation of the builds in the queue.
func QueueBuildFromAPI ¶
func QueueBuildFromAPI(b *api.QueueBuild) *QueueBuild
QueueBuildFromAPI converts the API QueueBuild type to a database build queue type.
func (*QueueBuild) ToAPI ¶
func (b *QueueBuild) ToAPI() *api.QueueBuild
ToAPI converts the QueueBuild type to a API QueueBuild type.
type Repo ¶
type Repo struct { ID sql.NullInt64 `sql:"id"` UserID sql.NullInt64 `sql:"user_id"` Hash sql.NullString `sql:"hash"` Org sql.NullString `sql:"org"` Name sql.NullString `sql:"name"` FullName sql.NullString `sql:"full_name"` Link sql.NullString `sql:"link"` Clone sql.NullString `sql:"clone"` Branch sql.NullString `sql:"branch"` Topics pq.StringArray `sql:"topics" gorm:"type:varchar(1020)"` BuildLimit sql.NullInt64 `sql:"build_limit"` Timeout sql.NullInt64 `sql:"timeout"` Counter sql.NullInt32 `sql:"counter"` Visibility sql.NullString `sql:"visibility"` Private sql.NullBool `sql:"private"` Trusted sql.NullBool `sql:"trusted"` Active sql.NullBool `sql:"active"` AllowEvents sql.NullInt64 `sql:"allow_events"` PipelineType sql.NullString `sql:"pipeline_type"` PreviousName sql.NullString `sql:"previous_name"` ApproveBuild sql.NullString `sql:"approve_build"` Owner User `gorm:"foreignKey:UserID"` }
Repo is the database representation of a repo.
func RepoFromAPI ¶
RepoFromAPI converts the API Repo type to a database repo type.
func (*Repo) Decrypt ¶
Decrypt will manipulate the existing repo hash by base64 decoding that value. Then, a AES-256 cipher block is created from the encryption key in order to decrypt the base64 decoded secret value.
func (*Repo) Encrypt ¶
Encrypt will manipulate the existing repo hash by creating a AES-256 cipher block from the encryption key in order to encrypt the repo hash. Then, the repo hash is base64 encoded for transport across network boundaries.
func (*Repo) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Repo type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type Schedule ¶
type Schedule struct { ID sql.NullInt64 `sql:"id"` RepoID sql.NullInt64 `sql:"repo_id"` Active sql.NullBool `sql:"active"` Name sql.NullString `sql:"name"` Entry sql.NullString `sql:"entry"` CreatedAt sql.NullInt64 `sql:"created_at"` CreatedBy sql.NullString `sql:"created_by"` UpdatedAt sql.NullInt64 `sql:"updated_at"` UpdatedBy sql.NullString `sql:"updated_by"` ScheduledAt sql.NullInt64 `sql:"scheduled_at"` Branch sql.NullString `sql:"branch"` Error sql.NullString `sql:"error"` Repo Repo `gorm:"foreignKey:RepoID"` }
func ScheduleFromAPI ¶
ScheduleFromAPI converts the API Schedule type to a database Schedule type.
func (*Schedule) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Schedule type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type User ¶
type User struct { ID sql.NullInt64 `sql:"id"` Name sql.NullString `sql:"name"` RefreshToken sql.NullString `sql:"refresh_token"` Token sql.NullString `sql:"token"` Favorites pq.StringArray `sql:"favorites" gorm:"type:varchar(5000)"` Active sql.NullBool `sql:"active"` Admin sql.NullBool `sql:"admin"` Dashboards pq.StringArray `sql:"dashboards" gorm:"type:varchar(5000)"` }
User is the database representation of a user.
func UserFromAPI ¶
UserFromAPI converts the API User type to a database User type.
func (*User) Decrypt ¶
Decrypt will manipulate the existing user tokens by base64 decoding them. Then, a AES-256 cipher block is created from the encryption key in order to decrypt the base64 decoded user tokens.
func (*User) Encrypt ¶
Encrypt will manipulate the existing user tokens by creating a AES-256 cipher block from the encryption key in order to encrypt the user tokens. Then, the user tokens are base64 encoded for transport across network boundaries.
func (*User) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the User type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.
type Worker ¶
type Worker struct { ID sql.NullInt64 `sql:"id"` Hostname sql.NullString `sql:"hostname"` Address sql.NullString `sql:"address"` Routes pq.StringArray `sql:"routes" gorm:"type:varchar(1000)"` Active sql.NullBool `sql:"active"` Status sql.NullString `sql:"status"` LastStatusUpdateAt sql.NullInt64 `sql:"last_status_update_at"` RunningBuildIDs pq.StringArray `sql:"running_build_ids" gorm:"type:varchar(500)"` LastBuildStartedAt sql.NullInt64 `sql:"last_build_started_at"` LastBuildFinishedAt sql.NullInt64 `sql:"last_build_finished_at"` LastCheckedIn sql.NullInt64 `sql:"last_checked_in"` BuildLimit sql.NullInt64 `sql:"build_limit"` }
Worker is the database representation of a worker.
func WorkerFromAPI ¶
WorkerFromAPI converts the API worker type to a database worker type.
func (*Worker) Nullify ¶
Nullify ensures the valid flag for the sql.Null types are properly set.
When a field within the Build type is the zero value for the field, the valid flag is set to false causing it to be NULL in the database.