models

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID        uint64 `json:"id" gorm:"primaryKey;autoIncrement;->"`
	Firstname string `json:"firstname" gorm:"size:255" validate:"required,min=1,max=255"`
	Surname   string `json:"surname" gorm:"size:255" validate:"required,min=1,max=255"`
}

Author represents an author entity with ID, Firstname, and Surname.

func (*Author) TableName added in v0.4.3

func (a *Author) TableName() string

TableName returns the author table name.

func (*Author) Validate

func (a *Author) Validate(v *validator.Validate) error

Validate validates the Author struct based on defined validation tags.

type Branch added in v0.6.0

type Branch struct {
	ID        uint    `json:"id" gorm:"primaryKey;autoIncrement;->"`
	Name      string  `json:"name" validate:"required,max=255"`
	Steps     float32 `json:"steps" validate:"gte=0.00" gorm:"default:0.00"`
	Currency  string  `json:"currency" validate:"required,oneof=EUR USD" gorm:"default:'EUR'"`
	Ordering  string  `json:"ordering" gorm:"type:text"`
	Public    bool    `json:"public" gorm:"default:false"`
	Pricelist string  `json:"pricelist" gorm:"type:text"`
	Cart      bool    `json:"cart" gorm:"default:false"`
	Content   string  `json:"content" gorm:"type:text"`
}

Branch represents a branch entity with various attributes.

func (*Branch) TableName added in v0.6.0

func (b *Branch) TableName() string

TableName returns the branch table name.

func (*Branch) Validate added in v0.6.0

func (b *Branch) Validate(v *validator.Validate) error

Validate validates the Branch struct based on defined validation tags.

type Condition added in v0.7.0

type Condition struct {
	ID       uint   `json:"id" gorm:"primaryKey;autoIncrement;->"`
	Name     string `json:"name" gorm:"type:varchar(255);not null;unique" validate:"required,min=1,max=255"`
	BranchID uint   `json:"branch_id" gorm:"index"`
	Branch   Branch `json:"branch" gorm:"foreignKey:BranchID"`
}

Condition model represents a book's condition.

func (Condition) TableName added in v0.7.0

func (Condition) TableName() string

TableName overrides the default table name for Condition model.

func (*Condition) Validate added in v0.7.0

func (c *Condition) Validate(db *gorm.DB) bool

Validate validates the Condition model based on defined rules.

type Tabler added in v0.6.0

type Tabler interface {
	TableName() string
}

Tabler interface for table name.

Jump to

Keyboard shortcuts

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