model

package
v3.1.11+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidField

func InvalidField(field string) error

InvalidField returns an error telling that field is invalid

Types

type App

type App struct {
	ID        uuid.UUID `sql:",pk" json:"id"`
	Name      string    `json:"name"`
	BundleID  string    `json:"bundleId"`
	CreatedBy string    `json:"createdBy"`
	CreatedAt int64     `json:"createdAt"`
	UpdatedAt int64     `json:"updatedAt"`
}

App is the app model struct

func (*App) Validate

func (a *App) Validate(c echo.Context) error

Validate implementation of the InputValidation interface

type Events

type Events struct {
	ID        uuid.UUID `sql:",pk" json:"id"`
	Message   string    `json:"message"`
	StatusID  uuid.UUID `sql:",notnull" json:"statusID"`
	State     string    `json:"state"`
	CreatedAt int64     `json:"createdAt"`
}

Events is the events model struct

type Job

type Job struct {
	ID                  uuid.UUID              `sql:",pk" json:"id"`
	TotalBatches        int                    `json:"totalBatches"`
	CompletedBatches    int                    `json:"completedBatches"`
	ControlGroup        float64                `json:"controlGroup"`
	TotalUsers          int                    `json:"totalUsers"`
	TotalTokens         int                    `json:"totalTokens"`
	CompletedTokens     int                    `json:"completedTokens"`
	DBPageSize          int                    `json:"dbPageSize"`
	Localized           bool                   `json:"localized"`
	CompletedAt         int64                  `json:"completedAt"`
	ExpiresAt           int64                  `json:"expiresAt"`
	StartsAt            int64                  `json:"startsAt"`
	Context             map[string]interface{} `json:"context"`
	Service             string                 `json:"service"`
	Filters             map[string]interface{} `json:"filters"`
	Metadata            map[string]interface{} `json:"metadata"`
	CSVPath             string                 `json:"csvPath"`
	ControlGroupCSVPath string                 `json:"controlGroupCsvPath"`
	CreatedBy           string                 `json:"createdBy"`
	App                 App                    `json:"app"`
	AppID               uuid.UUID              `json:"appId"`
	JobGroupID          uuid.UUID              `json:"jobGroupId" sql:",null"`
	TemplateName        string                 `json:"templateName"`
	PastTimeStrategy    string                 `json:"pastTimeStrategy"`
	Status              string                 `json:"status"`
	Feedbacks           map[string]interface{} `json:"feedbacks"`
	CreatedAt           int64                  `json:"createdAt"`
	UpdatedAt           int64                  `json:"updatedAt"`
	StatusEvents        []*Status              `json:"statusEvents"`
}

Job is the job model struct

func (*Job) GetJobInfoAndApp

func (j *Job) GetJobInfoAndApp(db interfaces.DB) error

GetJobInfoAndApp get the app and the job from the database job.ID must be set

func (*Job) GetJobTemplatesByNameAndLocale

func (j *Job) GetJobTemplatesByNameAndLocale(db interfaces.DB) (map[string]map[string]Template, error)

GetJobTemplatesByNameAndLocale ...

func (*Job) Labels

func (j *Job) Labels() []string

Labels return the labels for metrics

func (*Job) TagError

func (j *Job) TagError(db interfaces.DB, name, message string)

TagError create a status in one job

func (*Job) TagRunning

func (j *Job) TagRunning(db interfaces.DB, name, message string)

TagRunning create a status in one job

func (*Job) TagSuccess

func (j *Job) TagSuccess(db interfaces.DB, name, message string)

TagSuccess create a status in one job

func (*Job) Validate added in v0.5.0

func (j *Job) Validate(c echo.Context) error

Validate implementation of the InputValidation interface

type JobGroup

type JobGroup struct {
	ID    uuid.UUID `sql:",pk" json:"id"`
	AppID uuid.UUID `json:"appId"`
	Jobs  []*Job    `json:"jobs"`
}

JobGroup is a collection of jobs

type Status

type Status struct {
	ID        uuid.UUID `sql:",pk" json:"id"`
	Name      string    `json:"name"`
	JobID     uuid.UUID `sql:",notnull" json:"jobID"`
	CreatedAt int64     `json:"createdAt"`
	Events    []*Events `json:"events"`
	// contains filtered or unexported fields
}

Status is the status model struct

type Template

type Template struct {
	ID        uuid.UUID              `sql:",pk" json:"id"`
	Name      string                 `json:"name"`
	Locale    string                 `json:"locale"`
	Defaults  map[string]interface{} `json:"defaults"`
	Body      map[string]interface{} `json:"body"`
	CreatedBy string                 `json:"createdBy"`
	App       App                    `json:"app"`
	AppID     uuid.UUID              `json:"appId"`
	CreatedAt int64                  `json:"createdAt"`
	UpdatedAt int64                  `json:"updatedAt"`
}

Template is the template model struct

func (*Template) Validate added in v0.5.0

func (t *Template) Validate(c echo.Context) error

Validate implementation of the InputValidation interface

type User

type User struct {
	ID          uuid.UUID   `sql:",pk" json:"id"`
	Email       string      `json:"email"`
	IsAdmin     bool        `sql:",notnull" json:"isAdmin"`
	AllowedApps []uuid.UUID `pg:",array" json:"allowedApps"`
	CreatedBy   string      `json:"createdBy"`
	CreatedAt   int64       `json:"createdAt"`
	UpdatedAt   int64       `json:"updatedAt"`
}

User is the user model struct

func (*User) Validate

func (u *User) Validate(c echo.Context) error

Validate implementation of the InputValidation interface

Jump to

Keyboard shortcuts

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