models

package
v3.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0, 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 Column

type Column struct {
	ID          uuid.UUID     `json:"id" db:"id"`
	Name        dax.FieldName `json:"name" db:"name"`
	Type        dax.BaseType  `json:"type" db:"type"`
	TableID     string        `json:"table_id" db:"table_id"`
	Constraints string        `json:"constraints" db:"constraints"`
	Options     string        `json:"options" db:"options"`
	CreatedAt   time.Time     `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time     `json:"updated_at" db:"updated_at"`
}

Column is used by pop to map your columns database table to your go code.

func (*Column) String

func (c *Column) String() string

String is not required by pop and may be deleted

func (*Column) Validate

func (c *Column) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Column) ValidateCreate

func (c *Column) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Column) ValidateUpdate

func (c *Column) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Columns

type Columns []Column

Columns is not required by pop and may be deleted

func (Columns) String

func (c Columns) String() string

String is not required by pop and may be deleted

type Database

type Database struct {
	// should be DatabaseID, but pop doesn't allow ID to be a custom type
	ID             string           `json:"id" db:"id"`
	Name           dax.DatabaseName `json:"name" db:"name"`
	WorkersMin     int              `json:"workers_min" db:"workers_min"`
	WorkersMax     int              `json:"workers_max" db:"workers_max"`
	Description    string           `json:"description" db:"description"`
	Owner          string           `json:"owner" db:"owner"`
	UpdatedBy      string           `json:"updated_by" db:"updated_by"`
	Tables         Tables           `json:"tables" has_many:"tables" order_by:"name asc"`
	Organization   *Organization    `json:"organization" belongs_to:"organization"`
	OrganizationID string           `json:"organization_id" db:"organization_id"`
	CreatedAt      time.Time        `json:"created_at" db:"created_at"`
	UpdatedAt      time.Time        `json:"updated_at" db:"updated_at"`
}

Database is used by pop to map your databases database table to your go code.

func (Database) String

func (d Database) String() string

String is not required by pop and may be deleted

func (*Database) Validate

func (d *Database) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Database) ValidateCreate

func (d *Database) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Database) ValidateUpdate

func (d *Database) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Databases

type Databases []Database

Databases is not required by pop and may be deleted

func (Databases) String

func (d Databases) String() string

String is not required by pop and may be deleted

type DirectiveVersion

type DirectiveVersion struct {
	ID        int       `json:"id" db:"id"`
	Version   int       `json:"version" db:"version"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

DirectiveVersion holds what version the current directive is

func (*DirectiveVersion) String

func (t *DirectiveVersion) String() string

String is not required by pop and may be deleted

type Job

type Job struct {
	ID         uuid.UUID      `json:"id" db:"id"`
	Name       dax.Job        `json:"name" db:"name"`
	Role       dax.RoleType   `json:"role" db:"role"`
	DatabaseID dax.DatabaseID `json:"database_id" db:"database_id"`
	WorkerID   nulls.UUID     `json:"-" db:"worker_id"`
	Worker     *Worker        `json:"worker" db:"-" belongs_to:"worker"`
	CreatedAt  time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at" db:"updated_at"`
}

Job represents a job which can be assigned to a worker or free (unassigned).

func (*Job) String

func (t *Job) String() string

String is not required by pop and may be deleted

func (*Job) Validate

func (t *Job) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Job) ValidateCreate

func (t *Job) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Job) ValidateUpdate

func (t *Job) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Jobs

type Jobs []Job

Jobs is not required by pop and may be deleted

func (Jobs) String

func (t Jobs) String() string

String is not required by pop and may be deleted

type Node

type Node struct {
	ID        uuid.UUID   `json:"id" db:"id"`
	Address   dax.Address `json:"address" db:"address"`
	NodeRoles NodeRoles   `json:"node_roles" has_many:"node_roles" order_by:"created_at asc"`
	CreatedAt time.Time   `json:"created_at" db:"created_at"`
	UpdatedAt time.Time   `json:"updated_at" db:"updated_at"`
}

Node represents a host or server that is available to work on jobs.

func (*Node) String

func (t *Node) String() string

String is not required by pop and may be deleted

func (*Node) Validate

func (t *Node) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Node) ValidateCreate

func (t *Node) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Node) ValidateUpdate

func (t *Node) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type NodeRole

type NodeRole struct {
	ID        uuid.UUID    `json:"id" db:"id"`
	NodeID    uuid.UUID    `json:"node_id" db:"node_id"`
	Role      dax.RoleType `json:"role" db:"role"`
	CreatedAt time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt time.Time    `json:"updated_at" db:"updated_at"`
}

NodeRole holds information about what types of jobs (roles) each node can perform.

func (*NodeRole) String

func (t *NodeRole) String() string

String is not required by pop and may be deleted

type NodeRoles

type NodeRoles []NodeRole

func (NodeRoles) String

func (t NodeRoles) String() string

type Nodes

type Nodes []*Node

Nodes is not required by pop and may be deleted

func (Nodes) String

func (t Nodes) String() string

String is not required by pop and may be deleted

type Organization

type Organization struct {
	// Would love for this to be OrganizationID, but pop doesn't allow it for primary keys
	ID        string    `json:"id" db:"id"`
	Databases Databases `json:"databases" db:"-" has_many:"databases" order_by:"created_at asc"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

Organization is used by pop to map your organizations database table to your go code.

func (*Organization) String

func (o *Organization) String() string

String is not required by pop and may be deleted

func (*Organization) Validate

func (o *Organization) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Organization) ValidateCreate

func (o *Organization) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Organization) ValidateUpdate

func (o *Organization) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Organizations

type Organizations []Organization

Organizations is not required by pop and may be deleted

func (Organizations) String

func (o Organizations) String() string

String is not required by pop and may be deleted

type Table

type Table struct {
	// ID will store the dax.Table.Key(), but must be string type due to pop's nonsense
	ID             string             `json:"id" db:"id"`
	Name           dax.TableName      `json:"name" db:"name"`
	Owner          string             `json:"owner" db:"owner"`
	UpdatedBy      string             `json:"updated_by" db:"updated_by"`
	Database       *Database          `json:"database" belongs_to:"database"`
	DatabaseID     string             `json:"database_id" db:"database_id"`
	OrganizationID dax.OrganizationID `json:"organization_id" db:"organization_id"`
	Description    string             `json:"description" db:"description"`
	PartitionN     int                `json:"partition_n" db:"partition_n"`
	Columns        Columns            `json:"columns" has_many:"columns" order_by:"created_at asc"`
	CreatedAt      time.Time          `json:"created_at" db:"created_at"`
	UpdatedAt      time.Time          `json:"updated_at" db:"updated_at"`
}

Table is used by pop to map your tables database table to your go code.

func (*Table) String

func (t *Table) String() string

String is not required by pop and may be deleted

func (*Table) Validate

func (t *Table) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Table) ValidateCreate

func (t *Table) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Table) ValidateUpdate

func (t *Table) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Tables

type Tables []*Table

Tables is not required by pop and may be deleted

func (Tables) String

func (t Tables) String() string

String is not required by pop and may be deleted

type Worker

type Worker struct {
	ID         uuid.UUID    `json:"id" db:"id"`
	Address    dax.Address  `json:"address" db:"address"`
	Role       dax.RoleType `json:"role" db:"role"`
	DatabaseID nulls.String `json:"database_id" db:"database_id"` // this can be empty which means the worker is unassigned
	CreatedAt  time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt  time.Time    `json:"updated_at" db:"updated_at"`
	Jobs       Jobs         `json:"jobs" has_many:"jobs" order_by:"name asc"`
}

Worker is a node plus a role that gets assigned to a database and can be assigned jobs for that database.

func (*Worker) String

func (t *Worker) String() string

String is not required by pop and may be deleted

func (*Worker) Validate

func (t *Worker) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Worker) ValidateCreate

func (t *Worker) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Worker) ValidateUpdate

func (t *Worker) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Workers

type Workers []Worker

Workers is not required by pop and may be deleted

func (Workers) String

func (t Workers) String() string

String is not required by pop and may be deleted

Jump to

Keyboard shortcuts

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