model

package
v0.0.0-...-6b835ca Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	database.DBInterface `json:"-"`
	ID                   int64      `db:"id" json:"id"`
	NodeID               int64      `db:"node_id" json:"node_id" foreign:"fk_ra_files_node_id"`
	ParentID             zero.Int   `db:"parent_id" json:"parent_id" foreign:"fk_ra_files_parent_id"`
	JobID                zero.Int   `db:"job_id" json:"job_id" foreign:"fk_ra_files_job_id"`
	Dir                  string     `db:"dir" json:"dir" validate:"required"`
	File                 string     `db:"file" json:"file" validate:"required"`
	Type                 model.Node `db:"type" json:"type"`
	InsertedAt           time.Time  `db:"inserted_at" json:"inserted_at"`
	UpdatedAt            time.Time  `db:"updated_at" json:"updated_at"`
}

File job scripts database structure

func NewFile

func NewFile() *File

NewFile generate file structure

func (*File) TableName

func (d *File) TableName() string

TableName file structure database table name

func (*File) ToJSON

func (d *File) ToJSON() string

ToJSON file structure to json string

type FileLog

type FileLog struct {
	database.DBInterface `json:"-"`
	ID                   int64         `db:"id" json:"id"`
	NodeID               int64         `db:"node_id" json:"node_id" foreign:"fk_ra_file_logs_node_id"`
	FileID               int64         `db:"file_id" json:"file_id" foreign:"fk_ra_file_logs_file_id"`
	SourceUserID         zero.Int      `db:"source_user_id" json:"source_user_id" foreign:"fk_ra_file_logs_source_user_id"`
	Type                 model.Process `db:"type" json:"type"`
	Data                 FileLogData   `db:"data" json:"data,omitempty"`
	InsertedAt           time.Time     `db:"inserted_at" json:"inserted_at"`
}

FileLog log for file database structure

func NewFileLog

func NewFileLog(fileID int64) *FileLog

NewFileLog generate file log structure

func (*FileLog) TableName

func (d *FileLog) TableName() string

TableName upload log structure database table name

func (*FileLog) ToJSON

func (d *FileLog) ToJSON() string

ToJSON file log structure to json string

type FileLogData

type FileLogData struct {
	Dir  string     `json:"dir,omitempty"`
	File string     `json:"file,omitempty"`
	Type model.Node `json:"type,omitempty"`
}

FileLogData jsonb structure

func (*FileLogData) Scan

func (a *FileLogData) Scan(value interface{}) error

Scan file log data sql.Scanner

func (FileLogData) Value

func (a FileLogData) Value() (driver.Value, error)

Value file log data driver.Valuer

type Job

type Job struct {
	database.DBInterface `json:"-"`
	ID                   int64      `db:"id" json:"id"`
	NodeID               int64      `db:"node_id" json:"node_id" foreign:"fk_ra_jobs_node_id" validate:"required"`
	SourceUserID         zero.Int   `db:"source_user_id" json:"source_user_id" foreign:"fk_ra_jobs_source_user_id"`
	InsertedAt           time.Time  `db:"inserted_at" json:"inserted_at"`
	Detail               *JobDetail `json:"detail"`
}

Job user defined background job structure

func NewJob

func NewJob() *Job

NewJob generate user defined background job

func (*Job) TableName

func (d *Job) TableName() string

TableName job database table name

func (*Job) ToJSON

func (d *Job) ToJSON() string

ToJSON job structure to json string

type JobDetail

type JobDetail struct {
	database.DBInterface `json:"-"`
	ID                   int64    `db:"id" json:"id"`
	NodeID               int64    `db:"node_id" json:"node_id" foreign:"fk_ra_job_details_node_id" validate:"required"`
	JobID                int64    `db:"job_id" json:"job_id" foreign:"fk_ra_job_details_job_id" validate:"required"`
	SourceUserID         zero.Int `db:"source_user_id" foreign:"fk_ra_job_details_source_user_id" json:"source_user_id"`

	Code       string        `db:"code" json:"code" validate:"required,gte=3,lte=64"`
	Name       string        `db:"name" json:"name" validate:"required,gte=3,lte=200"`
	Type       model.JobType `db:"type" json:"type"`
	Detail     zero.String   `db:"detail" json:"detail"`
	Before     bool          `db:"before" json:"before"`
	BeforeJobs zero.String   `db:"before_jobs" json:"before_jobs"`
	After      bool          `db:"after" json:"after"`
	AfterJobs  zero.String   `db:"after_jobs" json:"after_jobs"`

	ScriptFile zero.String `db:"script_file" json:"script_file"`
	Script     zero.String `db:"script" json:"script"`

	InsertedAt time.Time `db:"inserted_at" json:"inserted_at"`
}

JobDetail user defined background job detail structure

func NewJobDetail

func NewJobDetail() *JobDetail

NewJobDetail generate user defined background job detail

func (JobDetail) TableName

func (d JobDetail) TableName() string

TableName job detail database table name

func (JobDetail) ToJSON

func (d JobDetail) ToJSON() string

ToJSON job detail structure to json string

type Node

type Node struct {
	database.DBInterface `json:"-"`
	ID                   int64       `db:"id" json:"id"`
	Name                 string      `db:"name" json:"name" validate:"required,gte=3,lte=200"`
	Code                 string      `db:"code" json:"code" unique:"ra_nodes_code_unique_index" validate:"required,gte=3,lte=200"`
	Detail               zero.String `db:"detail" json:"detail"`
	Type                 model.Node  `db:"type" json:"type"`
	InsertedAt           time.Time   `db:"inserted_at" json:"inserted_at"`
	UpdatedAt            time.Time   `db:"updated_at" json:"updated_at"`
}

Node application type structure

func NewNode

func NewNode() *Node

NewNode generate node structure

func (*Node) TableName

func (d *Node) TableName() string

TableName node database table name

func (*Node) ToJSON

func (d *Node) ToJSON() string

ToJSON node structure to json string

type User

type User struct {
	database.DBInterface `json:"-"`
	ID                   int64     `db:"id" json:"id"`
	NodeID               int64     `db:"node_id" json:"node_id" foreign:"fk_ra_users_node_id" validate:"required"`
	Username             string    `db:"username" json:"username" unique:"ra_users_username_unique_index" validate:"required"`
	PasswordDigest       string    `db:"password_digest" json:"-"`
	Password             string    `db:"-" json:"password" validate:"required"`
	Email                string    `db:"email" json:"email" unique:"ra_users_email_unique_index" validate:"required,email"`
	IsActive             bool      `db:"is_active" json:"is_active"`
	InsertedAt           zero.Time `db:"inserted_at" json:"inserted_at"`
	UpdatedAt            zero.Time `db:"updated_at" json:"updated_at"`
}

User Authentication/authorization base database model

func NewUser

func NewUser(pwd string) *User

NewUser user generate with default data

func (User) TableName

func (d User) TableName() string

TableName user database table name

func (User) ToJSON

func (d User) ToJSON() string

ToJSON User database model to json string

type UserPassphrase

type UserPassphrase struct {
	database.DBInterface `json:"-"`
	ID                   int64     `db:"id" json:"id"`
	NodeID               int64     `db:"node_id" json:"node_id" foreign:"fk_ra_user_passphrases_node_id" validate:"required"`
	UserID               int64     `db:"user_id" json:"user_id" foreign:"fk_ra_user_passphrases_user_id"`
	Passphrase           string    `db:"passphrase" json:"passphrase" unique:"ra_user_passphrases_passphrase_unique_index"`
	InsertedAt           time.Time `db:"inserted_at" json:"inserted_at"`
}

UserPassphrase authentication access token struct

func NewUserPassphrase

func NewUserPassphrase(userID int64) *UserPassphrase

NewUserPassphrase generate authentication access token

func (UserPassphrase) PassphraseQuery

func (d UserPassphrase) PassphraseQuery(db *database.Database) string

PassphraseQuery generate user_passphrase query string for database type

func (UserPassphrase) TableName

func (d UserPassphrase) TableName() string

TableName user_passphrase database table name

func (UserPassphrase) ToJSON

func (d UserPassphrase) ToJSON() string

ToJSON UserPassphrase database model to json string

type UserPassphraseInvalidation

type UserPassphraseInvalidation struct {
	database.DBInterface `json:"-"`
	PassphraseID         int64     `` /* 133-byte string literal not displayed */
	NodeID               int64     `db:"node_id" json:"node_id" foreign:"fk_ra_user_passphrases_invalidations_node_id" validate:"required"`
	SourceUserID         int64     `db:"source_user_id" json:"source_user_id" foreign:"fk_ra_user_passphrases_source_user_id"`
	InsertedAt           time.Time `db:"inserted_at" json:"inserted_at"`
}

UserPassphraseInvalidation authentication access token invalidation struct

func NewUserPassphraseInvalidation

func NewUserPassphraseInvalidation() *UserPassphraseInvalidation

NewUserPassphraseInvalidation generate authentication access token invalidation

func (UserPassphraseInvalidation) TableName

func (d UserPassphraseInvalidation) TableName() string

TableName user_passphrase_invalidation database table name

func (UserPassphraseInvalidation) ToJSON

ToJSON user passphrase invalidation structure to json string

Jump to

Keyboard shortcuts

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