entity

package
v0.0.0-...-cab7180 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: GPL-3.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 Base

type Base struct {
	ID        *string    `json:"id" gorm:"type:uuid;primaryKey" valid:"uuid"`
	CreatedAt *time.Time `json:"created_at" gorm:"column:created_at;autoUpdateTime" valid:"required"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"column:updated_at;autoCreateTime" valid:"-"`
}

type FilterTag

type FilterTag struct {
	Name *string `json:"name" valid:"-"`
}

func NewFilterTag

func NewFilterTag(name *string) (*FilterTag, error)

func (*FilterTag) IsValid

func (e *FilterTag) IsValid() error

type Guest

type Guest struct {
	Base `json:",inline" valid:"-"`
	Name *string `json:"name" gorm:"column:name;not null" valid:"required"`
	Doc  *string `json:"doc,omitempty" gorm:"column:doc;type:varchar(15);unique" valid:"doc"`
}

func NewGuest

func NewGuest(name, doc *string) (*Guest, error)

func (*Guest) IsValid

func (e *Guest) IsValid() error

type Score

type Score struct {
	Base        `json:",inline" valid:"-"`
	Date        *time.Time `json:"date" gorm:"column:date;not null" valid:"required"`
	Description *string    `json:"description,omitempty" gorm:"column:description;type:varchar(255)" valid:"-"`
	WasUsed     *bool      `json:"was_used" gorm:"column:was_used;not null" valid:"-"`
	UsedIn      *time.Time `json:"used_in,omitempty" gorm:"column:used_in" valid:"-"`
	Tags        []*Tag     `json:"tags,omitempty" gorm:"many2many:scores_tags" valid:"-"`
	GuestID     *string    `json:"guest_id" gorm:"column:guest_id;type:uuid;not null" valid:"uuid"`
	Guest       *Guest     `json:"-" valid:"-"`
}

func NewScore

func NewScore(date *time.Time, description *string, guest *Guest) (*Score, error)

func (*Score) AddTag

func (e *Score) AddTag(tag *Tag) error

func (*Score) IsValid

func (e *Score) IsValid() error

func (*Score) Use

func (e *Score) Use() error

type Tag

type Tag struct {
	Base   `json:",inline" valid:"-"`
	Name   *string  `json:"name" gorm:"column:name;not null;unique" valid:"required"`
	Scores []*Score `json:"scores,omitempty" gorm:"many2many:scores_tags" valid:"-"`
}

func NewTag

func NewTag(name *string) (*Tag, error)

func (*Tag) IsValid

func (e *Tag) IsValid() error

Jump to

Keyboard shortcuts

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