models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB is a connection to your database to be used throughout your application.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
	UserID    uuid.UUID `json:"user_id" db:"user_id"`
	Licenses  Licenses  `json:"licenses" db:"-" has_many:"licenses"`
	Name      string    `json:"name" db:"name"`
}

Application represents a user defined structure that can be updated. Access to an application is limited by Licenses.

func (Application) String

func (a Application) String() string

String is not required by pop and may be deleted

func (*Application) Validate

func (a *Application) 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 (*Application) ValidateUpdate

func (a *Application) 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 Applications

type Applications []Application

Applications is not required by pop and may be deleted

func (Applications) String

func (a Applications) String() string

String is not required by pop and may be deleted

type AuthToken

type AuthToken struct {
	ID        uuid.UUID `json:"id" db:"id"`
	Nonce     int       `json:"nonce" db:"nonce"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

AuthToken stores the jti of all currently valid API tokens used in actions/api

func (AuthToken) String

func (a AuthToken) String() string

String is not required by pop and may be deleted

func (*AuthToken) Validate

func (a *AuthToken) 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 (*AuthToken) ValidateCreate

func (a *AuthToken) 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 (*AuthToken) ValidateUpdate

func (a *AuthToken) 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 AuthTokens

type AuthTokens []AuthToken

AuthTokens is not required by pop and may be deleted

func (AuthTokens) String

func (a AuthTokens) String() string

String is not required by pop and may be deleted

type License

type License struct {
	ID            uuid.UUID   `json:"id" db:"id" form:"-"`
	CreatedAt     time.Time   `json:"created_at" db:"created_at" form:"-"`
	UpdatedAt     time.Time   `json:"updated_at" db:"updated_at" form:"-"`
	MachineLimit  int         `json:"machine_limit" db:"machine_limit"`
	User          User        `json:"user" db:"-" belongs_to:"user" form:"-"`
	UserID        uuid.UUID   `json:"user_id" db:"user_id" form:"-"`
	Application   Application `json:"application" db:"-" belongs_to:"application" form:"-"`
	ApplicationID uuid.UUID   `json:"application_id" db:"application_id" form:"-"`
	Machines      Machines    `json:"machines" db:"-" many_to_many:"machines_licenses" form:"-"`
}

License provides access to an application for a limited amount of machines.

func (License) String

func (l License) String() string

String is not required by pop and may be deleted

func (*License) Validate

func (l *License) 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 (*License) ValidateUpdate

func (l *License) 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 Licenses

type Licenses []License

Licenses is not required by pop and may be deleted

func (Licenses) String

func (l Licenses) String() string

String is not required by pop and may be deleted

type Machine added in v0.2.0

type Machine struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
	User      User      `json:"user" db:"-" belongs_to:"user" form:"-"`
	UserID    uuid.UUID `json:"user_id" db:"user_id" form:"-"`
	Licenses  Licenses  `json:"licenses" db:"-" many_to_many:"machines_licenses" form:"-"`
}

Machine represents an installation instance of software.

func (Machine) String added in v0.2.0

func (m Machine) String() string

String is not required by pop and may be deleted

func (*Machine) Validate added in v0.2.0

func (m *Machine) 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 (*Machine) ValidateCreate added in v0.2.0

func (m *Machine) 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 (*Machine) ValidateUpdate added in v0.2.0

func (m *Machine) 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 Machines added in v0.2.0

type Machines []Machine

Machines is not required by pop and may be deleted

func (Machines) String added in v0.2.0

func (m Machines) String() string

String is not required by pop and may be deleted

type Token

type Token struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
	User      User      `json:"user" db:"-" belongs_to:"user"`
	UserID    uuid.UUID `json:"user_id" db:"user_id"`
}

Token represents a confirmation token used to confirm/login users.

func (Token) String

func (t Token) String() string

String is not required by pop and may be deleted

func (*Token) Validate

func (t *Token) 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 (*Token) ValidateCreate

func (t *Token) 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.

type Tokens

type Tokens []Token

Tokens is not required by pop and may be deleted

func (Tokens) String

func (t Tokens) String() string

String is not required by pop and may be deleted

type User

type User struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
	Email     string    `json:"email" db:"email"`
}

User can create and manage applications and licenses.

func (User) String

func (u User) String() string

String is not required by pop and may be deleted

func (*User) Validate

func (u *User) 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 (*User) ValidateCreate

func (u *User) 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.

type Users

type Users []User

Users is not required by pop and may be deleted

func (Users) String

func (u Users) 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