court

package
v0.0.0-...-e6b7f3d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCourt = errors.New("invalid court")
)
View Source
var Table = "courts"

Functions

func Delete

func Delete(ctx context.Context, dbConn *gorm.DB, courtID string) error

Delete operates as controller to soft delete existing court

func ValidID

func ValidID(ctx context.Context, dbConn *gorm.DB, courtID int) bool

ValidID checks if a court ID is contained in the DB

Types

type Court

type Court struct {
	ID        int       `json:"id" gorm:"primary_key;unique;not null"`
	Name      string    `json:"name" gorm:"not null"`
	IsActive  bool      `json:"is_active" gorm:"default:false;not null"`
	IsDeleted bool      `json:"is_deleted" gorm:"default:false;not null"`
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;not null"`
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;not null"`
	DeletedAt time.Time `json:"deleted_at" gorm:"default:null"`
}

Court contains the schema for specific identity

func Create

func Create(ctx context.Context, dbConn *gorm.DB, newCourt *NewCourt) (*Court, error)

Create operates as controller to create a new court

func Read

func Read(ctx context.Context, dbConn *gorm.DB) ([]*Court, error)

Read operates as controller to list courts

func Update

func Update(ctx context.Context, dbConn *gorm.DB, updateCourt *UpdateCourt, courtID string) (*Court, error)

Update operates as controller to update existing court

func UpdateActive

func UpdateActive(ctx context.Context, dbConn *gorm.DB, courtID, status string) (*Court, error)

UpdateActive operates as controller to enable existing court

type NewCourt

type NewCourt struct {
	Name     string `json:"name"`
	IsActive bool   `json:"-"`
}

NewCourt contains the schema to create new identity

type UpdateCourt

type UpdateCourt struct {
	Name string `json:"name"`
}

UpdateCourt contains the schema to update existing identity

Jump to

Keyboard shortcuts

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