database

package
v0.0.0-...-9af728f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

func NewDatabase

func NewDatabase() (*gorm.DB, error)

Types

type CategoryOut

type CategoryOut struct {
	ID          uint   `json:"id,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	GroupID     uint   `json:"GroupId"`
	Deletable   bool   `json:"deletable"`
}

func GetCategories

func GetCategories(GroupID uint, categoryServiceURL string) ([]CategoryOut, error)

type CategoryServiceResponse

type CategoryServiceResponse struct {
	Categories []CategoryOut `json:"categories"`
}

type Group

type Group struct {
	gorm.Model
	ID          uint   `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
	Name        string `gorm:"not null;unique" json:"name"`
	Description string `gorm:"" json:"description,omitempty"`
}

func (*Group) Out

func (g *Group) Out() GroupOut

func (*Group) OutWithCategories

func (g *Group) OutWithCategories() GroupOutWithCategories

type GroupIn

type GroupIn struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

func (*GroupIn) In

func (g *GroupIn) In() Group

type GroupOut

type GroupOut struct {
	ID          uint   `json:"id,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

func GroupArrayOut

func GroupArrayOut(groupModels []Group) []GroupOut

type GroupOutWithCategories

type GroupOutWithCategories struct {
	ID          uint          `json:"id,omitempty"`
	Name        string        `json:"name"`
	Description string        `json:"description,omitempty"`
	Categories  []CategoryOut `json:"Categories"`
}

func GroupArrayOutWithCategories

func GroupArrayOutWithCategories(groupModels []Group) []GroupOutWithCategories

Jump to

Keyboard shortcuts

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