Documentation
¶
Index ¶
- Constants
- type Block
- type Credential
- type CredentialFormData
- type DueTasksTaskDetail
- type Event
- type File
- type JSONRawString
- type Page
- type PageData
- type PageWithMeta
- type PeriodicTask
- type PeriodicTaskDetail
- type PeriodicTaskFormData
- type Program
- type Setting
- type Store
- func (s *Store) CreateAdminUserIfNoUserExists() (*User, error)
- func (s *Store) DeleteBlockById(id int64) error
- func (s *Store) DeleteCredential(id int64) error
- func (s *Store) DeletePageById(id int64) error
- func (s *Store) DeletePeriodicTaskById(id int64) error
- func (s *Store) DeleteUser(userID int64) error
- func (s *Store) DeleteWebhookById(id int64) error
- func (s *Store) FetchCredentialByID(id int64) (*Credential, error)
- func (s *Store) FetchCredentialByName(name string) (*Credential, error)
- func (s *Store) FetchEventByBlockID(blockID int64, limit int, page int) (*[]Event, error)
- func (s *Store) FetchEventByID(id int64) (*Event, error)
- func (s *Store) FetchEventByTypeAndID(eventType string, id int64, idColumn string, limit int, page int) (*[]Event, error)
- func (s *Store) FetchEvents(eventType string, id int64, idColumn string, limit int, page int) (*[]Event, error)
- func (s *Store) GetAndLockDuePeriodicTasks() ([]DueTasksTaskDetail, error)
- func (s *Store) GetConfigByKey(key string) (string, error)
- func (s *Store) GetUserByID(id int64) (*User, error)
- func (s *Store) GetUserByUsername(username string) (*User, error)
- func (s *Store) InsertBlock(block Block) (sql.Result, error)
- func (s *Store) InsertBlockWithAutoName(description string, active bool) (int64, error)
- func (s *Store) InsertCredential(credential *Credential) error
- func (s *Store) InsertEvent(event Event) (sql.Result, error)
- func (s *Store) InsertPageWithAutoName(blockID int64) (int64, error)
- func (s *Store) InsertPeriodicTaskWithAutoName(blockID int64) (int64, error)
- func (s *Store) InsertSetting(key, value string)
- func (s *Store) InsertUser(user *User) error
- func (s *Store) InsertUserOLD(user *User) error
- func (s *Store) InsertWebhookWithAutoName(blockID int64) (int64, error)
- func (s *Store) ListBlocks() ([]Block, error)
- func (s *Store) ListCredentials() (*[]Credential, error)
- func (s *Store) ListCredentialsForEnv() (map[string]string, error)
- func (s *Store) ListExpiredCredentials() ([]Credential, error)
- func (s *Store) ListPagesByBlockID(blockID int64) ([]Page, error)
- func (s *Store) ListPeriodicTasksByBlockID(blockID int64) ([]PeriodicTask, error)
- func (s *Store) ListUsers() ([]User, error)
- func (s *Store) ListWebhooksByBlockID(blockID int64) ([]Webhook, error)
- func (s *Store) RecordTaskFailure(id int64) error
- func (s *Store) RecordTaskSuccess(id int64) error
- func (s *Store) RefreshTokens() error
- func (s *Store) RemoveEventsOlderThanAWeek() (sql.Result, error)
- func (s *Store) SaveToken(id int64, token *oauth2.Token) error
- func (s *Store) SearchBlocks(query string) ([]Block, error)
- func (s *Store) SearchCredentials(query string) ([]Credential, error)
- func (s *Store) SearchPages(blockID int64, query string) ([]Page, error)
- func (s *Store) SearchPeriodicTasks(blockID int64, query string) ([]PeriodicTask, error)
- func (s *Store) SearchUsers(query string) ([]User, error)
- func (s *Store) SearchWebhooks(blockID int64, query string) ([]Webhook, error)
- func (s *Store) SelectBlockById(id int64) (*Block, error)
- func (s *Store) SelectPageById(id int64) (*PageWithMeta, error)
- func (s *Store) SelectPageByPath(path string) (*Page, error)
- func (s *Store) SelectPeriodicTaskDetailsById(id int64) (*PeriodicTaskDetail, error)
- func (s *Store) SelectWebhookById(id int64) (*Webhook, error)
- func (s *Store) SelectWebhookByPath(path string, verb string) (*WebHookDetail, error)
- func (s *Store) SelectWebhookDetailsById(id int64) (*WebhookDetail, error)
- func (s *Store) UnlockPeriodicTask(id int64) error
- func (s *Store) UnlockStalePeriodicTasks() error
- func (s *Store) UpdateBlock(id int64, block Block) error
- func (s *Store) UpdateConfigByKey(key, value string)
- func (s *Store) UpdateCredential(credential *Credential) error
- func (s *Store) UpdateFileContentByWebhookID(webhookID int64, formData WebhookFormData) error
- func (s *Store) UpdateName(table string, id int64, newName string) (string, error)
- func (s *Store) UpdatePageByID(id int64, pageData PageData) error
- func (s *Store) UpdatePeriodicTaskByFrom(periodicTaskID int64, formData PeriodicTaskFormData) error
- func (s *Store) UpdatePeriodicTaskNextRunAt(id int64, nextRunAt time.Time) error
- func (s *Store) UpdateUser(user *User) error
- func (s *Store) UpdateWebhookPath(id int64, newPath string) (string, error)
- func (s *Store) UserExists() (bool, error)
- func (s *Store) VerifyPassword(storedHash string, password string) bool
- type User
- type WebHookDetail
- type Webhook
- type WebhookAuthConfig
- type WebhookDetail
- type WebhookFormData
Constants ¶
View Source
const ( GrantTypeClientCredentials = "client_credentials" GrantTypeAuthorizationCode = "authorization_code" GrantTypeRefreshToken = "refresh_token" CredentialTypeOAuth = "oauth" CredentialTypeText = "text" )
View Source
const AdminRole = "admin"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
ID int64 `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
Active bool `json:"active" db:"active"`
EnvVariables sql.NullString `json:"envVariables" db:"env_variables"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
}
func (*Block) GetEnvVars ¶
type Credential ¶
type Credential struct {
ID int64 `db:"id"`
Type string `db:"type"`
Name string `db:"name"`
OauthUrl sql.NullString `db:"oauth_url"`
OauthTokenUrl sql.NullString `db:"oauth_token_url"`
GrantType string `db:"grant_type"`
Scope sql.NullString `db:"scope"`
Value sql.NullString `db:"value"`
ClientID sql.NullString `db:"client_id"`
ClientSecret sql.NullString `db:"client_secret"`
Token sql.NullString `db:"token"`
RefreshToken sql.NullString `db:"refresh_token"`
Expiry sql.NullString `db:"expiry"`
UpdatedAt time.Time `db:"updated_at"`
}
type CredentialFormData ¶
type CredentialFormData struct {
Name string `form:"name"`
Type string `form:"type"`
Value string `form:"value"`
OauthUrl string `form:"oauth_url"`
TokenUrl string `form:"token_url"`
Scope string `form:"scope"`
ClientID string `form:"client_id"`
ClientSecret string `form:"client_secret"`
Token string `form:"token"`
RefreshToken string `form:"refresh_token"`
Expiry string `form:"expiry"`
}
type DueTasksTaskDetail ¶
type DueTasksTaskDetail struct {
PeriodicTaskDetail
Block Block `json:"block" db:"block"`
}
type Event ¶
type Event struct {
ID int `json:"id" db:"id"`
Status string `json:"status" db:"status"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
EventType string `json:"event_type" db:"event_type"`
Args sql.NullString `json:"args" db:"args"`
Logs sql.NullString `json:"logs" db:"logs"`
WebhookID sql.NullInt64 `json:"webhook_id" db:"webhook_id"`
PeriodicTaskID sql.NullInt64 `json:"periodic_task_id" db:"periodic_task_id"`
BlockID int64 `json:"block_id" db:"block_id"`
}
type JSONRawString ¶
Custom type to handle JSON unmarshalling
func (*JSONRawString) Scan ¶
func (j *JSONRawString) Scan(value interface{}) error
Implement the sql.Scanner interface for JSONRawString
type Page ¶
type Page struct {
ID int64 `json:"id" db:"id"`
Path string `json:"path" db:"path"`
Name sql.NullString `json:"name" db:"name"`
Description sql.NullString `json:"description" db:"description"`
Active bool `json:"active" db:"active"`
Protected bool `json:"protected" db:"protected"`
BlockID int `json:"blockId" db:"block_id"`
CanvasState JSONRawString `json:"canvas_state" db:"canvas_state"`
HTMLOutput sql.NullString `json:"htmlOutput" db:"html_output"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
type PageWithMeta ¶
type PeriodicTask ¶
type PeriodicTask struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name" db:"name"`
Description sql.NullString `json:"description" db:"description"`
Active bool `json:"active" db:"active"`
EnvVariables sql.NullString `json:"envVariables" db:"env_variables"`
BlockID int64 `json:"blockId" db:"block_id"`
ProgramID int64 `json:"programId" db:"program_id"`
Timezone string `json:"timezone" db:"timezone"`
Cron string `json:"cron" db:"cron"`
NextRunAt time.Time `json:"nextRunAt" db:"next_run_at"`
OnFailScript sql.NullString `json:"onFailScript" db:"on_fail_script"`
OnFailScriptType sql.NullString `json:"onFailScriptType" db:"on_fail_script_type"`
OnFailEnabled bool `json:"onFailEnabled" db:"on_fail_enabled"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
func (*PeriodicTask) GetEnvVars ¶
func (w *PeriodicTask) GetEnvVars() map[string]string
type PeriodicTaskDetail ¶
type PeriodicTaskDetail struct {
PeriodicTask PeriodicTask `json:"periodicTask" db:"periodic_task"`
Program Program `json:"program" db:"program"`
File File `json:"file" db:"file"`
Block Block `json:"block" db:"block"`
}
db tag is needed for matching in same cases
type PeriodicTaskFormData ¶
type PeriodicTaskFormData struct {
Name string `form:"name"`
Description string `form:"description"`
Env string `form:"env"`
Active bool `form:"active" `
FileContent string `form:"editor" `
Cron string `form:"cron" validate:"cron"`
Code string `form:"editor"`
ProgramType string `form:"programType"`
OnFailScript string `form:"onFailScript"`
OnFailScriptType string `form:"onFailScriptType"`
OnFailEnabled bool `form:"onFailEnabled"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateAdminUserIfNoUserExists ¶
func (*Store) DeleteBlockById ¶
func (*Store) DeleteCredential ¶
func (*Store) DeletePageById ¶
func (*Store) DeletePeriodicTaskById ¶
func (*Store) DeleteUser ¶
func (*Store) DeleteWebhookById ¶
func (*Store) FetchCredentialByID ¶
func (s *Store) FetchCredentialByID(id int64) (*Credential, error)
func (*Store) FetchCredentialByName ¶
func (s *Store) FetchCredentialByName(name string) (*Credential, error)
func (*Store) FetchEventByBlockID ¶
func (*Store) FetchEventByTypeAndID ¶
func (*Store) FetchEvents ¶
func (*Store) GetAndLockDuePeriodicTasks ¶
func (s *Store) GetAndLockDuePeriodicTasks() ([]DueTasksTaskDetail, error)
func (*Store) InsertBlockWithAutoName ¶
InsertBlockWithAutoName inserts a new block with an auto-generated name based on the max id in the blocks table.
func (*Store) InsertCredential ¶
func (s *Store) InsertCredential(credential *Credential) error
func (*Store) InsertPageWithAutoName ¶
func (*Store) InsertPeriodicTaskWithAutoName ¶
func (*Store) InsertSetting ¶
func (*Store) InsertUser ¶
func (*Store) InsertUserOLD ¶
func (*Store) InsertWebhookWithAutoName ¶
func (*Store) ListBlocks ¶
func (*Store) ListCredentials ¶
func (s *Store) ListCredentials() (*[]Credential, error)
func (*Store) ListCredentialsForEnv ¶
func (*Store) ListExpiredCredentials ¶
func (s *Store) ListExpiredCredentials() ([]Credential, error)
func (*Store) ListPagesByBlockID ¶
ListPagesByBlockID retrieves pages associated with a given block ID.
func (*Store) ListPeriodicTasksByBlockID ¶
func (s *Store) ListPeriodicTasksByBlockID(blockID int64) ([]PeriodicTask, error)
ListPeriodicTasksByBlockID retrieves periodic runs associated with a given block ID.
func (*Store) ListWebhooksByBlockID ¶
func (*Store) RecordTaskFailure ¶
func (*Store) RecordTaskSuccess ¶
func (*Store) RefreshTokens ¶
func (*Store) RemoveEventsOlderThanAWeek ¶
func (*Store) SearchCredentials ¶
func (s *Store) SearchCredentials(query string) ([]Credential, error)
func (*Store) SearchPages ¶
func (*Store) SearchPeriodicTasks ¶
func (s *Store) SearchPeriodicTasks(blockID int64, query string) ([]PeriodicTask, error)
func (*Store) SearchWebhooks ¶
func (*Store) SelectPageById ¶
func (s *Store) SelectPageById(id int64) (*PageWithMeta, error)
func (*Store) SelectPeriodicTaskDetailsById ¶
func (s *Store) SelectPeriodicTaskDetailsById(id int64) (*PeriodicTaskDetail, error)
func (*Store) SelectWebhookByPath ¶
func (s *Store) SelectWebhookByPath(path string, verb string) (*WebHookDetail, error)
func (*Store) SelectWebhookDetailsById ¶
func (s *Store) SelectWebhookDetailsById(id int64) (*WebhookDetail, error)
func (*Store) UnlockPeriodicTask ¶
func (*Store) UnlockStalePeriodicTasks ¶
func (*Store) UpdateConfigByKey ¶
func (*Store) UpdateCredential ¶
func (s *Store) UpdateCredential(credential *Credential) error
func (*Store) UpdateFileContentByWebhookID ¶
func (s *Store) UpdateFileContentByWebhookID(webhookID int64, formData WebhookFormData) error
func (*Store) UpdateName ¶
make it shorter
func (*Store) UpdatePeriodicTaskByFrom ¶
func (s *Store) UpdatePeriodicTaskByFrom(periodicTaskID int64, formData PeriodicTaskFormData) error
func (*Store) UpdatePeriodicTaskNextRunAt ¶
func (*Store) UpdateUser ¶
func (*Store) UpdateWebhookPath ¶
func (*Store) UserExists ¶
type User ¶
type User struct {
ID int64 `json:"id" db:"id"`
Username string `json:"username" db:"username"`
PasswordHash string `json:"passwordHash" db:"password_hash"`
Email sql.NullString `json:"email" db:"email"`
Settings sql.NullString `json:"settings" db:"settings"`
Role string `json:"role" db:"role"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
type WebHookDetail ¶
type Webhook ¶
type Webhook struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name" db:"name"`
Description sql.NullString `json:"description" db:"description"`
Active bool `json:"active" db:"active"`
EnvVariables sql.NullString `json:"envVariables" db:"env_variables"`
BlockID int `json:"blockId" db:"block_id"`
Path string `json:"path" db:"path"`
FullPath string `json:"fullPath" db:"-"`
Cors sql.NullString `json:"cors" db:"cors"`
HttpMethod string `json:"httpMethod" db:"http_method"`
ResponseHeaders sql.NullString `json:"responseHeaders" db:"response_headers"`
ExitHttpPair sql.NullString `json:"exitHttpPair" db:"exit_http_pair"`
AuthConfig sql.NullString `json:"authConfig" db:"auth_config"`
OnFailScript sql.NullString `json:"onFailScript" db:"on_fail_script"`
OnFailScriptType sql.NullString `json:"onFailScriptType" db:"on_fail_script_type"`
OnFailEnabled bool `json:"onFailEnabled" db:"on_fail_enabled"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
ProgramID int `json:"programId" db:"program_id"`
}
func (*Webhook) GetAuthConfig ¶
func (w *Webhook) GetAuthConfig() *WebhookAuthConfig
func (*Webhook) GetEnvVars ¶
func (*Webhook) GetExitHttpPair ¶
func (*Webhook) GetResponseHeaders ¶
type WebhookAuthConfig ¶
type WebhookDetail ¶
type WebhookFormData ¶
type WebhookFormData struct {
ExitCodes []string `form:"exitCode[]" binding:"dive"`
HTTPResponseCodes []string `form:"httpResponseCode[]" binding:"dive"`
ResponseHeaders string `form:"responseHeaders"`
Name string `form:"name"`
ProgramType string `form:"programType"`
Description string `form:"description"`
Env string `form:"env"`
Active bool `form:"active" `
FileContent string `form:"editor" `
HttpVerb string `form:"httpVerb" `
Cors string `form:"cors" `
Code string `form:"editor"`
AuthConfig string `form:"authConfig"`
OnFailScript string `form:"onFailScript"`
OnFailScriptType string `form:"onFailScriptType"`
OnFailEnabled bool `form:"onFailEnabled"`
}
Click to show internal directories.
Click to hide internal directories.