Documentation ¶
Index ¶
- func BoolPtr(b bool) *bool
- func HashPassword(pw string) (*string, error)
- func JobRunStatusPtr(status db.JobRunStatus) *db.JobRunStatus
- func StepRunStatusPtr(status db.StepRunStatus) *db.StepRunStatus
- func StringPtr(s string) *string
- func VerifyPassword(hashedPW, candidate string) (bool, error)
- type CreateDispatcherOpts
- type CreateEventOpts
- type CreateSessionOpts
- type CreateTenantMemberOpts
- type CreateTenantOpts
- type CreateTickerOpts
- type CreateUserOpts
- type CreateWorkerOpts
- type CreateWorkflowJobOpts
- type CreateWorkflowJobRunOpts
- type CreateWorkflowRunOpts
- type CreateWorkflowStepOpts
- type CreateWorkflowStepRunOpts
- type CreateWorkflowTagOpts
- type CreateWorkflowVersionOpts
- type DispatcherRepository
- type EventRepository
- type JobRunRepository
- type ListAllJobRunsOpts
- type ListAllStepRunsOpts
- type ListEventOpts
- type ListEventResult
- type ListStepRunsOpts
- type ListTickerOpts
- type ListWorkersOpts
- type ListWorkflowRunsOpts
- type ListWorkflowRunsResult
- type ListWorkflowsOpts
- type ListWorkflowsResult
- type ListWorkflowsRow
- type Repository
- type StepRepository
- type StepRunRepository
- type TenantRepository
- type TickerRepository
- type UpdateDispatcherOpts
- type UpdateJobRunLookupDataOpts
- type UpdateJobRunOpts
- type UpdateSessionOpts
- type UpdateStepRunOpts
- type UpdateTenantMemberOpts
- type UpdateTickerOpts
- type UpdateUserOpts
- type UpdateWorkerOpts
- type UserRepository
- type UserSessionRepository
- type WorkerRepository
- type WorkerWithStepCount
- type WorkflowRepository
- type WorkflowRunRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
func JobRunStatusPtr ¶
func JobRunStatusPtr(status db.JobRunStatus) *db.JobRunStatus
func StepRunStatusPtr ¶
func StepRunStatusPtr(status db.StepRunStatus) *db.StepRunStatus
func VerifyPassword ¶
Types ¶
type CreateDispatcherOpts ¶
type CreateDispatcherOpts struct {
ID string `validate:"required,uuid"`
}
type CreateEventOpts ¶
type CreateEventOpts struct { // (required) the tenant id TenantId string `validate:"required,uuid"` // (required) the event key - must be in actionId form Key string `validate:"required,actionId"` // (optional) the event data Data *db.JSON // (optional) the event that this event is replaying ReplayedEvent *string `validate:"omitempty,uuid"` }
type CreateSessionOpts ¶
type CreateTenantMemberOpts ¶
type CreateTenantOpts ¶
type CreateTickerOpts ¶
type CreateTickerOpts struct {
ID string `validate:"required,uuid"`
}
type CreateUserOpts ¶
type CreateWorkerOpts ¶
type CreateWorkerOpts struct { // The id of the dispatcher DispatcherId string `validate:"required,uuid"` // The name of the worker Name string `validate:"required,hatchetName"` // The name of the service Services []string `validate:"dive,hatchetName"` // A list of actions this worker can run Actions []string `validate:"dive,actionId"` }
type CreateWorkflowJobOpts ¶
type CreateWorkflowJobOpts struct { // (required) the job name Name string `validate:"required,hatchetName"` // (optional) the job description Description *string // (optional) the job timeout Timeout *string // (required) the job steps Steps []CreateWorkflowStepOpts `validate:"required,min=1,dive"` }
type CreateWorkflowJobRunOpts ¶
type CreateWorkflowJobRunOpts struct { // (required) the job id JobId string `validate:"required,uuid"` // (optional) the job run input Input *db.JSON // (required) the job step runs StepRuns []CreateWorkflowStepRunOpts `validate:"required,min=1,dive"` // (optional) the job run requeue after time, if not set this defaults to 5 seconds after the // current time RequeueAfter *time.Time `validate:"omitempty"` }
type CreateWorkflowRunOpts ¶
type CreateWorkflowRunOpts struct { // (required) the workflow version id WorkflowVersionId string `validate:"required,uuid"` // (optional) the event id that triggered the workflow run TriggeringEventId *string `validate:"omitnil,uuid,required_without=Cron,excluded_with=Cron"` // (optional) the cron schedule that triggered the workflow run Cron *string `validate:"omitnil,cron,required_without=TriggeringEventId,excluded_with=TriggeringEventId"` CronParentId *string `validate:"omitempty,uuid,required_without=TriggeringEventId,excluded_with=TriggeringEventId"` // (required) the workflow jobs JobRuns []CreateWorkflowJobRunOpts `validate:"required,min=1,dive"` }
func GetCreateWorkflowRunOptsFromCron ¶
func GetCreateWorkflowRunOptsFromCron(cron, cronParentId string, workflowVersion *db.WorkflowVersionModel) (*CreateWorkflowRunOpts, error)
func GetCreateWorkflowRunOptsFromEvent ¶
func GetCreateWorkflowRunOptsFromEvent(event *db.EventModel, workflowVersion *db.WorkflowVersionModel) (*CreateWorkflowRunOpts, error)
type CreateWorkflowStepOpts ¶
type CreateWorkflowStepRunOpts ¶
type CreateWorkflowStepRunOpts struct { // (required) the step id StepId string `validate:"required,uuid"` }
type CreateWorkflowTagOpts ¶
type CreateWorkflowVersionOpts ¶
type CreateWorkflowVersionOpts struct { // (required) the workflow name Name string `validate:"required,hatchetName"` Tags []CreateWorkflowTagOpts `validate:"dive"` // (optional) the workflow description Description *string // (required) the workflow version Version string `validate:"required"` // (optional) event triggers for the workflow EventTriggers []string `validate:"dive,actionId"` // (optional) cron triggers for the workflow CronTriggers []string `validate:"dive,cron"` // (required) the workflow jobs Jobs []CreateWorkflowJobOpts `validate:"required,min=1,dive"` }
type DispatcherRepository ¶
type DispatcherRepository interface { // GetDispatcherForWorker returns the dispatcher connected to a given worker. GetDispatcherForWorker(workerId string) (*db.DispatcherModel, error) // CreateNewDispatcher creates a new dispatcher for a given tenant. CreateNewDispatcher(opts *CreateDispatcherOpts) (*db.DispatcherModel, error) // UpdateDispatcher updates a dispatcher for a given tenant. UpdateDispatcher(dispatcherId string, opts *UpdateDispatcherOpts) (*db.DispatcherModel, error) Delete(dispatcherId string) error // AddWorker adds a worker to a dispatcher. AddWorker(dispatcherId, workerId string) (*db.DispatcherModel, error) }
type EventRepository ¶
type EventRepository interface { // ListEvents returns all events for a given tenant. ListEvents(tenantId string, opts *ListEventOpts) (*ListEventResult, error) // ListEventKeys returns all unique event keys for a given tenant. ListEventKeys(tenantId string) ([]string, error) // GetEventById returns an event by id. GetEventById(id string) (*db.EventModel, error) // ListEventsById returns a list of events by id. ListEventsById(tenantId string, ids []string) ([]db.EventModel, error) // CreateEvent creates a new event for a given tenant. CreateEvent(opts *CreateEventOpts) (*db.EventModel, error) }
type JobRunRepository ¶
type JobRunRepository interface { ListAllJobRuns(opts *ListAllJobRunsOpts) ([]db.JobRunModel, error) GetJobRunById(tenantId, jobRunId string) (*db.JobRunModel, error) UpdateJobRun(tenantId, jobRunId string, opts *UpdateJobRunOpts) (*db.JobRunModel, error) GetJobRunLookupData(tenantId, jobRunId string) (*db.JobRunLookupDataModel, error) UpdateJobRunLookupData(tenantId, jobRunId string, opts *UpdateJobRunLookupDataOpts) (*db.JobRunLookupDataModel, error) }
type ListAllJobRunsOpts ¶
type ListAllJobRunsOpts struct { TickerId *string NoTickerId *bool Status *db.JobRunStatus }
type ListAllStepRunsOpts ¶
type ListAllStepRunsOpts struct { TickerId *string NoTickerId *bool Status *db.StepRunStatus }
type ListEventOpts ¶
type ListEventOpts struct { // (optional) a list of event keys to sort by Keys []string // (optional) number of events to skip Offset *int // (optional) number of events to return Limit *int // (optional) the event that this event is replaying ReplayedEvent *string `validate:"omitempty,uuid"` // (optional) the order by field OrderBy *string `validate:"omitempty,oneof=createdAt"` // (optional) the order direction OrderDirection *string `validate:"omitempty,oneof=ASC DESC"` }
type ListEventResult ¶
type ListEventResult struct { Rows []*dbsqlc.ListEventsRow Count int }
type ListStepRunsOpts ¶
type ListStepRunsOpts struct { Requeuable *bool JobRunId *string Status *db.StepRunStatus }
type ListTickerOpts ¶
type ListWorkersOpts ¶
type ListWorkersOpts struct {
Action *string `validate:"omitempty,actionId"`
}
type ListWorkflowRunsOpts ¶
type ListWorkflowRunsOpts struct { // (optional) the workflow version id WorkflowId *string `validate:"omitempty,uuid"` // (optional) the event id that triggered the workflow run EventId *string `validate:"omitempty,uuid"` // (optional) number of events to skip Offset *int // (optional) number of events to return Limit *int }
type ListWorkflowRunsResult ¶
type ListWorkflowRunsResult struct { Rows []*dbsqlc.ListWorkflowRunsRow Count int }
type ListWorkflowsOpts ¶
type ListWorkflowsResult ¶
type ListWorkflowsResult struct { Rows []*ListWorkflowsRow Count int }
type ListWorkflowsRow ¶
type ListWorkflowsRow struct { *db.WorkflowModel LatestRun *db.WorkflowRunModel }
type Repository ¶
type Repository interface { Event() EventRepository Tenant() TenantRepository Workflow() WorkflowRepository WorkflowRun() WorkflowRunRepository JobRun() JobRunRepository StepRun() StepRunRepository Step() StepRepository Dispatcher() DispatcherRepository Ticker() TickerRepository Worker() WorkerRepository UserSession() UserSessionRepository User() UserRepository }
type StepRepository ¶
type StepRunRepository ¶
type StepRunRepository interface { // ListAllStepRuns returns a list of all step runs which match the given options. ListAllStepRuns(opts *ListAllStepRunsOpts) ([]db.StepRunModel, error) // ListStepRuns returns a list of step runs for a tenant which match the given options. ListStepRuns(tenantId string, opts *ListStepRunsOpts) ([]db.StepRunModel, error) UpdateStepRun(tenantId, stepRunId string, opts *UpdateStepRunOpts) (*db.StepRunModel, error) GetStepRunById(tenantId, stepRunId string) (*db.StepRunModel, error) CancelPendingStepRuns(tenantId, jobRunId, reason string) error }
type TenantRepository ¶
type TenantRepository interface { // CreateTenant creates a new tenant. CreateTenant(opts *CreateTenantOpts) (*db.TenantModel, error) // ListTenants lists all tenants in the instance ListTenants() ([]db.TenantModel, error) // GetTenantByID returns the tenant with the given id GetTenantByID(tenantId string) (*db.TenantModel, error) // GetTenantBySlug returns the tenant with the given slug GetTenantBySlug(slug string) (*db.TenantModel, error) // CreateTenantMember creates a new member in the tenant CreateTenantMember(tenantId string, opts *CreateTenantMemberOpts) (*db.TenantMemberModel, error) // GetTenantMemberByID returns the tenant member with the given id GetTenantMemberByID(memberId string) (*db.TenantMemberModel, error) // GetTenantMemberByUserID returns the tenant member with the given user id GetTenantMemberByUserID(tenantId string, userId string) (*db.TenantMemberModel, error) // UpdateTenantMember updates the tenant member with the given id UpdateTenantMember(memberId string, opts *UpdateTenantMemberOpts) (*db.TenantMemberModel, error) // DeleteTenantMember deletes the tenant member with the given id DeleteTenantMember(memberId string) (*db.TenantMemberModel, error) }
type TickerRepository ¶
type TickerRepository interface { // CreateNewTicker creates a new ticker. CreateNewTicker(opts *CreateTickerOpts) (*db.TickerModel, error) // UpdateTicker updates a ticker. UpdateTicker(tickerId string, opts *UpdateTickerOpts) (*db.TickerModel, error) // ListTickers lists tickers. ListTickers(opts *ListTickerOpts) ([]db.TickerModel, error) // Delete deletes a ticker. Delete(tickerId string) error // AddJobRun assigns a job run to a ticker. AddJobRun(tickerId string, jobRun *db.JobRunModel) (*db.TickerModel, error) // AddStepRun assigns a step run to a ticker. AddStepRun(tickerId, stepRunId string) (*db.TickerModel, error) // AddCron assigns a cron to a ticker. AddCron(tickerId string, cron *db.WorkflowTriggerCronRefModel) (*db.TickerModel, error) // RemoveCron removes a cron from a ticker. RemoveCron(tickerId string, cron *db.WorkflowTriggerCronRefModel) (*db.TickerModel, error) }
type UpdateDispatcherOpts ¶
type UpdateJobRunOpts ¶
type UpdateJobRunOpts struct {
Status *db.JobRunStatus
}
type UpdateSessionOpts ¶
type UpdateStepRunOpts ¶
type UpdateTenantMemberOpts ¶
type UpdateTenantMemberOpts struct {
Role *string `validate:"omitempty,oneof=OWNER ADMIN MEMBER"`
}
type UpdateTickerOpts ¶
type UpdateUserOpts ¶
type UpdateWorkerOpts ¶
type UpdateWorkerOpts struct { // The status of the worker Status *db.WorkerStatus // When the last worker heartbeat was LastHeartbeatAt *time.Time // A list of actions this worker can run Actions []string `validate:"dive,actionId"` }
type UserRepository ¶
type UserRepository interface { // GetUserByID returns the user with the given id GetUserByID(id string) (*db.UserModel, error) // GetUserByEmail returns the user with the given email GetUserByEmail(email string) (*db.UserModel, error) // GetUserPassword returns the user password with the given id GetUserPassword(id string) (*db.UserPasswordModel, error) // CreateUser creates a new user with the given options CreateUser(*CreateUserOpts) (*db.UserModel, error) // UpdateUser updates the user with the given email UpdateUser(id string, opts *UpdateUserOpts) (*db.UserModel, error) // ListTenantMemberships returns the list of tenant memberships for the given user ListTenantMemberships(userId string) ([]db.TenantMemberModel, error) }
type UserSessionRepository ¶
type UserSessionRepository interface { Create(opts *CreateSessionOpts) (*db.UserSessionModel, error) Update(sessionId string, opts *UpdateSessionOpts) (*db.UserSessionModel, error) Delete(sessionId string) (*db.UserSessionModel, error) GetById(sessionId string) (*db.UserSessionModel, error) }
UserSessionRepository represents the set of queries on the UserSession model
type WorkerRepository ¶
type WorkerRepository interface { // ListWorkers lists workers for the tenant ListWorkers(tenantId string, opts *ListWorkersOpts) ([]WorkerWithStepCount, error) // ListRecentWorkerStepRuns lists recent step runs for a given worker ListRecentWorkerStepRuns(tenantId, workerId string) ([]db.StepRunModel, error) // CreateNewWorker creates a new worker for a given tenant. CreateNewWorker(tenantId string, opts *CreateWorkerOpts) (*db.WorkerModel, error) // UpdateWorker updates a worker for a given tenant. UpdateWorker(tenantId, workerId string, opts *UpdateWorkerOpts) (*db.WorkerModel, error) // DeleteWorker removes the worker from the database DeleteWorker(tenantId, workerId string) error // GetWorkerById returns a worker by its id. GetWorkerById(workerId string) (*db.WorkerModel, error) // AddStepRun assigns a step run to a worker. AddStepRun(tenantId, workerId, stepRunId string) error }
type WorkerWithStepCount ¶
type WorkerWithStepCount struct { Worker *db.WorkerModel StepRunCount int }
type WorkflowRepository ¶
type WorkflowRepository interface { // ListWorkflows returns all workflows for a given tenant. ListWorkflows(tenantId string, opts *ListWorkflowsOpts) (*ListWorkflowsResult, error) // CreateNewWorkflow creates a new workflow for a given tenant. It will create the parent // workflow based on the version's name. CreateNewWorkflow(tenantId string, opts *CreateWorkflowVersionOpts) (*db.WorkflowVersionModel, error) // CreateWorkflowVersion creates a new workflow version for a given tenant. This will fail if there is // not a parent workflow with the same name already in the database. CreateWorkflowVersion(tenantId string, opts *CreateWorkflowVersionOpts) (*db.WorkflowVersionModel, error) // GetWorkflowById returns a workflow by its name. It will return db.ErrNotFound if the workflow does not exist. GetWorkflowById(workflowId string) (*db.WorkflowModel, error) // GetWorkflowByName returns a workflow by its name. It will return db.ErrNotFound if the workflow does not exist. GetWorkflowByName(tenantId, workflowName string) (*db.WorkflowModel, error) // ListWorkflowsForEvent returns the latest workflow versions for a given tenant that are triggered by the // given event. ListWorkflowsForEvent(tenantId, eventKey string) ([]db.WorkflowVersionModel, error) // GetWorkflowVersionById returns a workflow version by its id. It will return db.ErrNotFound if the workflow // version does not exist. GetWorkflowVersionById(tenantId, workflowId string) (*db.WorkflowVersionModel, error) // DeleteWorkflow deletes a workflow for a given tenant. DeleteWorkflow(tenantId, workflowId string) (*db.WorkflowModel, error) }
type WorkflowRunRepository ¶
type WorkflowRunRepository interface { // ListWorkflowRuns returns workflow runs for a given workflow version id. ListWorkflowRuns(tenantId string, opts *ListWorkflowRunsOpts) (*ListWorkflowRunsResult, error) // CreateNewWorkflowRun creates a new workflow run for a workflow version. CreateNewWorkflowRun(tenantId string, opts *CreateWorkflowRunOpts) (*db.WorkflowRunModel, error) // GetWorkflowRunById returns a workflow run by id. GetWorkflowRunById(tenantId, runId string) (*db.WorkflowRunModel, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.