models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	// ID is the primary key of the team.
	ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"`
	// Name is the name of the environment.
	Name string `json:"name" gorm:"uniqueIndex:idx_project_environment"`
	// Project is the project of the environment.
	Project Project `json:"project" form:"project"`
	// ProjectID is the project id of the environment.
	ProjectID uuid.UUID `json:"project_id" gorm:"uniqueIndex:idx_project_environment"`
	// States is the states of the environment.
	States []State `json:"states" gorm:"foreignKey:EnvironmentID"`
	// Username is the username of the environment.
	Username string `json:"username"`
	// Password is the password of the environment.
	Password string `json:"password"`
	// Description is the description of the environment.
	Description *string `json:"description" form:"description"`
	// CreatedAt is the time the team was created.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the time the team was last updated.
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the time the team was deleted.
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Environment is a specific environment for a project.

func (*Environment) BeforeCreate

func (e *Environment) BeforeCreate(db *gorm.DB) (err error)

BeforeCreate gorm hook

func (*Environment) ComparePassword

func (e *Environment) ComparePassword(password string) error

ComparePassword compares User.Password hash with raw password

func (*Environment) HashPassword

func (e *Environment) HashPassword() error

HashPassword substitutes User.Password with its bcrypt hash

type Lock

type Lock struct {
	// ID is the primary key of the lock.
	ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()" params:"id"`
	// Info is the info of the lock.
	Info string `json:"info" form:"info"`
	// Operation is the operation of the lock.
	Operation string `json:"operation" form:"operation"`
	// Path is the path of the lock.
	Path string `json:"path" form:"path"`
	// Version is the version of the lock.
	Version string `json:"version" form:"version"`
	// Who is the who of the lock.
	Who string `json:"who" form:"who"`
	// Environment is the environment of the lock.
	Environment Environment `json:"environment" form:"environment"`
	// EnvironmentID is the environment id of the lock.
	EnvironmentID uuid.UUID `json:"environment_id" gorm:"uniqueIndex:idx_environment_lock,sort:desc"`
	// CreatedAt is the time the team was created.
	CreatedAt time.Time
	// UpdatedAt is the time the team was last updated.
	UpdatedAt time.Time
}

Lock is a lock for a project.

type Project

type Project struct {
	// ID is the primary key of the team.
	ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"`
	// Name is the name of the project.
	Name string `json:"name" gorm:"uniqueIndex:idx_team_name"`
	// Owner is the owner of the project.
	Owner Team `json:"owner"`
	// OwnerID is the team id of the project.
	OwnerID uuid.UUID `json:"owner_id" gorm:"uniqueIndex:idx_team_name"`
	// Description is the description of the project.
	Description *string `json:"description"`
	// Environments are the environments in the project.
	Environments []Environment `json:"environments" gorm:"foreignKey:ProjectID"`
	// CreatedAt is the time the team was created.
	CreatedAt time.Time
	// UpdatedAt is the time the team was last updated.
	UpdatedAt time.Time
	// DeletedAt is the time the team was deleted.
	DeletedAt gorm.DeletedAt
}

Project ...

type Snapshot

type Snapshot struct {
	// ID is the primary key of the snapshot.
	ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()" params:"id"`
	// Title is the name of the snapshot.
	Title string `json:"name" form:"name" validate:"required,alphanum,gt=3,lt=255"`
	// Description is the description of the snapshot.
	Description *string `json:"description" form:"description" validate:"omitempty,max=1024"`
	// Environment is the environment of the state.
	Environment Environment `json:"environment" form:"environment"`
	// EnvironmentID is the environment id of the state.
	EnvironmentID uuid.UUID `json:"environment_id" gorm:"uniqueIndex:idx_project_environment_state"`
	// Project is the project of the state.
	Project Project `json:"project" form:"project"`
	// ProjectID is the project id of the state.
	ProjectID uuid.UUID `json:"project_id" gorm:"uniqueIndex:idx_project_environment_state"`
	// State is the state of the snapshot.
	State State `json:"state" form:"state"`
	// StateID is the state id of the snapshot.
	StateID uuid.UUID `json:"version" gorm:"uniqueIndex:idx_project_environment_state"`
	// Data is the data of the state.
	Data datatypes.JSON `json:"data" form:"data"`
	// CreatedAt is the time the snapshot was created.
	CreatedAt time.Time
	// UpdatedAt is the time the snapshot was last updated.
	UpdatedAt time.Time
	// DeletedAt is the time the snapshot was deleted.
	DeletedAt gorm.DeletedAt
}

Snapshot ...

type State

type State struct {
	// ID is the primary key of the state.
	ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()" params:"id"`
	// Environment is the environment of the state.
	Environment Environment `json:"environment" form:"environment"`
	// EnvironmentID is the environment id of the state.
	EnvironmentID uuid.UUID `json:"environment_id" gorm:"uniqueIndex:idx_project_environment_version"`
	// Project is the project of the state.
	Project Project `json:"project" form:"project"`
	// ProjectID is the project id of the state.
	ProjectID uuid.UUID `json:"project_id" gorm:"uniqueIndex:idx_project_environment_version"`
	// Data is the data of the state.
	Data datatypes.JSON `json:"data" form:"data"`
	// Version is the version of the state.
	Version uint `json:"version" gorm:"type:integer;default:1;uniqueIndex:idx_project_environment_version" params:"version"`
	// CreatedAt is the time the state was created.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the time the state was last updated.
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the time the state was deleted.
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

State ...

type Team

type Team struct {
	// ID is the unique identifier of the team.
	ID uuid.UUID `json:"id" gorm:"primaryKey;unique;type:uuid;column:id;default:gen_random_uuid()"`
	// Name is the name of the team.
	Name string `json:"name" gorm:"unique" validate:"required,max=255"`
	// Description is the description of the team.
	Description string `json:"description" validate:"max=255"`
	// CreatedAt is the creation time of the team.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the update time of the team.
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the deletion time of the team.
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Team is a team in the application.

Jump to

Keyboard shortcuts

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