Go API Documentation

github.com/semaphoreui/semaphore/db/sql

No package summary is available.

Package

Files: 24. Third party imports: 7. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Constants

Vars

Types

SqlDb

This type doesn't have documentation.

Field name Field type Comment
sql

*gorp.DbMap

No comment on field.

migration_2_10_24

This type doesn't have documentation.

Field name Field type Comment
db

*SqlDb

No comment on field.

migration_2_8_26

This type doesn't have documentation.

Field name Field type Comment
db

*SqlDb

No comment on field.

migration_2_8_42

This type doesn't have documentation.

Field name Field type Comment
db

*SqlDb

No comment on field.

Functions

func InsertTemplateFromType

Uses: reflect.Indirect, reflect.ValueOf.

func (*SqlDb) AddEmailOtpVerification

Uses: db.ErrNotFound.

func (*SqlDb) AddTotpVerification

Uses: db.GetParsedTime, tz.Now.

func (*SqlDb) ApplyMigration

ApplyMigration runs executes a database migration

Uses: fmt.Printf, fmt.Println, log.Fatal, log.Warnf, tz.Now.

func (*SqlDb) ClearRunnerCache

Uses: tz.Now.

func (*SqlDb) Close

func (*SqlDb) Connect

Uses: db.APIToken, db.AccessKey, db.Environment, db.Inventory, db.Project, db.Repository, db.Session, db.Task, db.TaskOutput, db.Template, db.User, log.Warn, util.Config, util.DbDriverMySQL, util.DbDriverPostgres.

func (*SqlDb) CreateAPIToken

Uses: db.GetParsedTime, tz.Now.

func (*SqlDb) CreateAccessKey

func (*SqlDb) CreateAnsibleTaskError

func (*SqlDb) CreateAnsibleTaskHost

func (*SqlDb) CreateEnvironment

func (*SqlDb) CreateEvent

Uses: tz.Now.

func (*SqlDb) CreateIntegration

func (*SqlDb) CreateIntegrationAlias

func (*SqlDb) CreateIntegrationExtractValue

func (*SqlDb) CreateIntegrationMatcher

func (*SqlDb) CreateInventory

func (*SqlDb) CreateObject

Uses: reflect.ValueOf.

func (*SqlDb) CreateProject

Uses: tz.Now.

func (*SqlDb) CreateProjectUser

func (*SqlDb) CreateRepository

func (*SqlDb) CreateRunner

Uses: base64.StdEncoding, securecookie.GenerateRandomKey.

func (*SqlDb) CreateSchedule

func (*SqlDb) CreateSession

func (*SqlDb) CreateTask

func (*SqlDb) CreateTaskOutput

func (*SqlDb) CreateTaskStage

func (*SqlDb) CreateTaskStageResult

Uses: json.Marshal.

func (*SqlDb) CreateTemplate

Uses: db.FillTemplate, db.ObjectToJSON.

func (*SqlDb) CreateTemplateVault

func (*SqlDb) CreateUser

Uses: bcrypt.GenerateFromPassword, db.GetParsedTime, db.ValidateUser, tz.Now.

func (*SqlDb) CreateUserWithoutPassword

Uses: db.GetParsedTime, db.ValidateUser, tz.Now.

func (*SqlDb) CreateView

func (*SqlDb) DeleteAPIToken

func (*SqlDb) DeleteAccessKey

Uses: db.AccessKeyProps.

func (*SqlDb) DeleteEmailOtpVerification

Uses: db.ErrNotFound.

func (*SqlDb) DeleteEnvironment

Uses: db.EnvironmentProps.

func (*SqlDb) DeleteGlobalRunner

Uses: db.GlobalRunnerProps.

func (*SqlDb) DeleteIntegration

Uses: db.IntegrationProps.

func (*SqlDb) DeleteIntegrationAlias

Uses: db.IntegrationAliasProps.

func (*SqlDb) DeleteIntegrationExtractValue

Uses: db.IntegrationExtractValueProps, db.IntegrationProps.

func (*SqlDb) DeleteIntegrationMatcher

Uses: db.IntegrationMatcherProps, db.IntegrationProps.

func (*SqlDb) DeleteInventory

Uses: db.InventoryProps.

func (*SqlDb) DeleteOption

Uses: db.OptionProps, db.ValidateOptionKey.

func (*SqlDb) DeleteOptions

Uses: db.ValidateOptionKey.

func (*SqlDb) DeleteProject

func (*SqlDb) DeleteProjectUser

func (*SqlDb) DeleteRepository

Uses: db.RepositoryProps.

func (*SqlDb) DeleteRunner

Uses: db.ErrNotFound.

func (*SqlDb) DeleteSchedule

func (*SqlDb) DeleteTaskWithOutputs

func (*SqlDb) DeleteTemplate

func (*SqlDb) DeleteTotpVerification

func (*SqlDb) DeleteUser

func (*SqlDb) DeleteView

Uses: db.ViewProps.

func (*SqlDb) EndTaskStage

func (*SqlDb) ExpireAPIToken

func (*SqlDb) ExpireSession

func (*SqlDb) GetAPIToken

func (*SqlDb) GetAPITokens

Uses: db.ErrNotFound, errors.Is, sql.ErrNoRows.

func (*SqlDb) GetAccessKey

Uses: db.AccessKeyProps.

func (*SqlDb) GetAccessKeyRefs

Uses: db.AccessKeyProps.

func (*SqlDb) GetAccessKeys

Uses: db.AccessKey, db.AccessKeyProps.

func (*SqlDb) GetAllAdmins

func (*SqlDb) GetAllObjects

Uses: squirrel.Select.

func (*SqlDb) GetAllObjectsByForeignKey

Uses: squirrel.Select.

func (*SqlDb) GetAllProjects

Uses: squirrel.Select.

func (*SqlDb) GetAllRunners

Uses: db.GlobalRunnerProps, db.RetrieveQueryParams, squirrel.SelectBuilder.

func (*SqlDb) GetAnsibleTaskErrors

Uses: db.AnsibleTaskError.

func (*SqlDb) GetAnsibleTaskHosts

Uses: db.AnsibleTaskHost.

func (*SqlDb) GetEnvironment

Uses: db.EnvironmentProps.

func (*SqlDb) GetEnvironmentRefs

Uses: db.EnvironmentProps.

func (*SqlDb) GetEnvironmentSecrets

Uses: db.AccessKey, db.AccessKeyProps, db.RetrieveQueryParams.

func (*SqlDb) GetEnvironments

Uses: db.Environment, db.EnvironmentProps.

func (*SqlDb) GetEvents

Uses: squirrel.Select.

func (*SqlDb) GetGlobalRunner

Uses: db.GlobalRunnerProps.

func (*SqlDb) GetIntegration

Uses: db.IntegrationProps.

func (*SqlDb) GetIntegrationAliases

Uses: db.IntegrationAliasProps, squirrel.Select.

func (*SqlDb) GetIntegrationExtractValue

Uses: squirrel.Eq, squirrel.Select.

func (*SqlDb) GetIntegrationExtractValueRefs

Uses: db.IntegrationExtractValueProps, db.IntegrationProps.

func (*SqlDb) GetIntegrationExtractValues

Uses: db.IntegrationExtractValue, db.IntegrationExtractValueProps, db.IntegrationProps.

func (*SqlDb) GetIntegrationMatcher

Uses: squirrel.Eq, squirrel.Select.

func (*SqlDb) GetIntegrationMatcherRefs

Uses: db.IntegrationMatcherProps, db.IntegrationProps.

func (*SqlDb) GetIntegrationMatchers

Uses: squirrel.Eq, squirrel.Select.

func (*SqlDb) GetIntegrationRefs

func (*SqlDb) GetIntegrations

Uses: db.IntegrationProps.

func (*SqlDb) GetIntegrationsByAlias

Uses: db.ErrNotFound, db.Integration, db.IntegrationAlias, db.IntegrationAliasProject, db.IntegrationAliasProps, db.IntegrationAliasSingle, db.RetrieveQueryParams, squirrel.Select.

func (*SqlDb) GetInventories

Uses: db.Inventory, db.InventoryProps, squirrel.Eq, squirrel.SelectBuilder.

func (*SqlDb) GetInventory

Uses: db.FillInventory, db.InventoryProps.

func (*SqlDb) GetInventoryRefs

Uses: db.InventoryProps.

func (*SqlDb) GetObject

Uses: squirrel.Eq, squirrel.Select.

func (*SqlDb) GetObjectReferences

Find Object Referrers for objectID based on referring column taken from referringObjectProps Example: GetObjectReferences(db.WebhookMatchers, db.WebhookExtractorProps, integrationID)

Uses: db.ObjectReferrer, reflect.New, reflect.SliceOf.

func (*SqlDb) GetObjectsByForeignKeyQuery

Uses: squirrel.Select.

func (*SqlDb) GetOption

Uses: db.ErrNotFound, errors.Is.

func (*SqlDb) GetOptions

Uses: db.Option, db.OptionProps, db.ValidateOptionKey, squirrel.SelectBuilder.

func (*SqlDb) GetProUserCount

func (*SqlDb) GetProject

Uses: squirrel.Select.

func (*SqlDb) GetProjectSchedules

func (*SqlDb) GetProjectTasks

Uses: db.TaskWithTpl.

func (*SqlDb) GetProjectUser

Uses: db.ProjectUser.

func (*SqlDb) GetProjectUsers

Uses: db.UserProps, squirrel.Select.

func (*SqlDb) GetProjects

Uses: squirrel.Select.

func (*SqlDb) GetReferencesForForeignKey

Retrieve the Matchers & Values referencing `id' from WebhookExtractor

Examples: referrerCollection := db.ObjectReferrers{}

d.GetReferencesForForeignKey(db.ProjectProps, id, map[string]db.ObjectProps{
  'Templates': db.TemplateProps,
  'Inventories': db.InventoryProps,
  'Repositories': db.RepositoryProps
}, &referrerCollection)

//

referrerCollection := db.WebhookExtractorReferrers{}

d.GetReferencesForForeignKey(db.WebhookProps, id, map[string]db.ObjectProps{
  "Matchers": db.WebhookMatcherProps,
  "Values": db.WebhookExtractValueProps
}, &referrerCollection)

Uses: reflect.ValueOf.

func (*SqlDb) GetRepositories

Uses: squirrel.Select.

func (*SqlDb) GetRepository

Uses: db.Repository, db.RepositoryProps.

func (*SqlDb) GetRepositoryRefs

Uses: db.RepositoryProps.

func (*SqlDb) GetRunner

Uses: db.ErrNotFound.

func (*SqlDb) GetRunnerByToken

Uses: db.ErrNotFound, db.GlobalRunnerProps, db.RetrieveQueryParams, db.Runner, squirrel.SelectBuilder.

func (*SqlDb) GetRunnerTags

Uses: db.Runner, db.RunnerTag, squirrel.Eq, squirrel.NotEq, squirrel.Select.

func (*SqlDb) GetRunners

Uses: db.Runner.

func (*SqlDb) GetSchedule

func (*SqlDb) GetSchedules

func (*SqlDb) GetSession

func (*SqlDb) GetTask

Uses: squirrel.Select.

func (*SqlDb) GetTaskOutputs

Uses: squirrel.Select.

func (*SqlDb) GetTaskStageOutputs

Uses: squirrel.GtOrEq, squirrel.LtOrEq, squirrel.Select.

func (*SqlDb) GetTaskStageResult

func (*SqlDb) GetTaskStages

func (*SqlDb) GetTaskStats

Uses: db.TaskStat, db.TaskStatUnitDay, fmt.Errorf, squirrel.Select.

func (*SqlDb) GetTemplate

Uses: db.FillTemplate.

func (*SqlDb) GetTemplateRefs

Uses: db.TemplateProps.

func (*SqlDb) GetTemplateSchedules

Uses: squirrel.Select.

func (*SqlDb) GetTemplateTasks

func (*SqlDb) GetTemplateVaults

Uses: db.FillTemplateVault, db.TemplateVault.

func (*SqlDb) GetTemplates

Uses: db.RetrieveQueryParams, db.TaskWithTpl, db.Template, db.TemplateProps, json.Unmarshal, squirrel.Select.

func (*SqlDb) GetUser

GetUser retrieves a user from the database by ID

Uses: db.ErrNotFound, db.UserTotp, errors.Is.

func (*SqlDb) GetUserByLoginOrEmail

Uses: db.ErrNotFound, db.UserTotp, errors.Is.

func (*SqlDb) GetUserCount

func (*SqlDb) GetUserEvents

Uses: squirrel.Select.

func (*SqlDb) GetUsers

Uses: db.UserProps, squirrel.Like, squirrel.Select.

func (*SqlDb) GetView

Uses: db.ViewProps.

func (*SqlDb) GetViews

Uses: db.RetrieveQueryParams, db.ViewProps.

func (*SqlDb) IsInitialized

func (*SqlDb) IsMigrationApplied

IsMigrationApplied queries the database to see if a migration table with this version id exists already

func (*SqlDb) PermanentConnection

func (*SqlDb) PrepareQuery

func (*SqlDb) RekeyAccessKeys

Uses: db.AccessKey, db.AccessKeyProps, db.ErrNotFound, db.RetrieveQueryParams, errors.Is.

func (*SqlDb) SetOption

Uses: db.ErrNotFound, errors.Is.

func (*SqlDb) SetScheduleActive

func (*SqlDb) SetScheduleCommitHash

func (*SqlDb) SetScheduleLastCommitHash

func (*SqlDb) SetSessionVerificationMethod

func (*SqlDb) SetTemplateDescription

func (*SqlDb) SetUserPassword

Uses: bcrypt.GenerateFromPassword.

func (*SqlDb) SetViewPositions

func (*SqlDb) Sql

func (*SqlDb) TouchRunner

Uses: tz.Now.

func (*SqlDb) TouchSession

Uses: tz.Now.

func (*SqlDb) TryRollbackMigration

TryRollbackMigration attempts to rollback the database to an earlier version if a rollback exists

Uses: fmt.Printf, fmt.Println, log.Error, log.Fields, log.WithError.

func (*SqlDb) UpdateAccessKey

Uses: sql.Result.

func (*SqlDb) UpdateEnvironment

func (*SqlDb) UpdateIntegration

func (*SqlDb) UpdateIntegrationExtractValue

func (*SqlDb) UpdateIntegrationMatcher

func (*SqlDb) UpdateInventory

func (*SqlDb) UpdateProject

func (*SqlDb) UpdateProjectUser

func (*SqlDb) UpdateRepository

func (*SqlDb) UpdateRunner

func (*SqlDb) UpdateSchedule

func (*SqlDb) UpdateTask

func (*SqlDb) UpdateTemplate

Uses: db.ObjectToJSON.

func (*SqlDb) UpdateTemplateVaults

Uses: db.TemplateVault, strconv.Itoa, strings.Join.

func (*SqlDb) UpdateUser

Uses: bcrypt.GenerateFromPassword.

func (*SqlDb) UpdateView

func (*SqlDb) VerifySession

func (migration_2_10_24) PreApply

func (migration_2_8_26) PostApply

Uses: strings.Split.

func (migration_2_8_42) PostApply

Private functions

func connect

References: sql.Open, util.Config.

func createDb

References: log.Warn, sql.Open, util.Config.

func escapeLike

References: strings.ReplaceAll.

func getQueryForParams

func getVersionErrPath

getVersionErrPath is the humanoid version with '.err' and file format appended

func getVersionPath

getVersionPath is the humanoid version with the file format appended

func getVersionSQL

getVersionSQL takes a path to an SQL file and returns it from embed.FS a slice of strings separated by newlines

References: log.WithError, path.Join, strings.ReplaceAll, strings.Split, strings.Trim.

func handleRollbackError

References: log.Warn.

func validateAPIToken

References: errors.New, regexp.MatchString.

func validateMutationResult

validateMutationResult checks the success of the update query

References: db.ErrInvalidOperation, strings.Contains.

func clearTasks

References: db.Task, rand.Intn.

func deleteByReferrer

func deleteObject

func deleteObjectByReferencedID

func exec

func execTx

func getEvents

References: db.FillEvents.

func getObject

References: squirrel.Select.

func getObjectByReferrer

References: squirrel.Select.

func getObjectRefs

References: db.IntegrationAliasProps, db.InventoryProps, db.RepositoryProps, db.ScheduleProps, db.TemplateProps.

func getObjectRefsFrom

References: db.ObjectReferrer, db.Schedule, db.ScheduleProps, db.TemplateProps, reflect.New, reflect.SliceOf, reflect.Value, strconv.Itoa, strings.Join.

func getObjects

func getObjectsByReferrer

References: squirrel.Select.

func getOption

References: db.Option, db.OptionProps, squirrel.Select.

func getTaskStage

func getTaskStages

References: squirrel.Eq, squirrel.Select.

func getTasks

References: squirrel.Eq, squirrel.Select.

func insert

func makeObjectsQuery

References: squirrel.Eq, squirrel.Select.

func prepareMigration

prepareMigration converts migration SQLite-query to current dialect. Supported MySQL and Postgres dialects.

References: strings.Join.

func prepareQueryWithDialect

References: strconv.Itoa, strings.Builder.

func selectAll

func selectOne

References: db.ErrNotFound, errors.Is, sql.ErrNoRows.

func validateTask


Tests

Files: 1. Third party imports: 1. Imports from organisation: 0. Tests: 1. Benchmarks: 0.

Test functions

TestValidatePort