models

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClusterNotFound = gorm.ErrRecordNotFound

ErrClusterNotFound is the error to represent a failed lookup of a cluster db record

Functions

func NewClusterStore

func NewClusterStore(dbconn *gorm.DB) dataStore

creates a db connection via gorm

Types

type Cluster

type Cluster struct {
	ID            int    `gorm:"primaryKey;uniqueIndex"`
	Name          string `gorm:"not null;default:null"`
	GoogleProject string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

Cluster is the data structure that models a persisted to a database via gorm

type ClusterStore

type ClusterStore interface {
	ListAll() ([]Cluster, error)
	CreateNew(CreateClusterRequest) (Cluster, error)
	GetByID(int) (Cluster, error)
	GetByName(string) (Cluster, error)
}

clusterStore is the interface defining allowed db actions for Cluster

type CreateClusterRequest

type CreateClusterRequest struct {
	Name string `json:"name" binding:"required"`
}

CreateClusterRequest struct defines the data required to create a new cluster in db

func (CreateClusterRequest) ClusterReq

func (createClusterRequest CreateClusterRequest) ClusterReq() Cluster

creates a cluster entity object to be persisted with the database from a request to create a cluster.

Jump to

Keyboard shortcuts

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