model

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultFilter

type DefaultFilter struct {
	Limit  int
	Offset int
	Order  []string
}

func (*DefaultFilter) Apply

func (f *DefaultFilter) Apply(q *orm.Query) (*orm.Query, error)

type Group

type Group struct {
	ID                         int          `pg:",pk" json:"id" gqlgen:"id"`
	ConqueredVillagesChannelID string       `pg:",use_zero" json:"conqueredVillagesChannelID" gqlgen:"conqueredVillagesChannelID"`
	LostVillagesChannelID      string       `pg:",use_zero" json:"lostVillagesChannelID" gqlgen:"lostVillagesChannelID"`
	ShowEnnobledBarbarians     bool         `pg:",use_zero"`
	ShowInternals              bool         `pg:",use_zero"`
	ServerID                   string       `pg:"on_delete:CASCADE,use_zero" json:"serverID" gqlgen:"serverID"`
	Server                     *Server      `json:"server,omitempty" gqlgen:"server" pg:"rel:has-one"`
	Observations               Observations `json:"observation,omitempty" gqlgen:"observation" pg:"rel:has-many"`
}

type GroupFilter

type GroupFilter struct {
	ID       []int
	ServerID []string
	DefaultFilter
}

func (*GroupFilter) Apply

func (f *GroupFilter) Apply(q *orm.Query) (*orm.Query, error)

func (*GroupFilter) ApplyWithAlias

func (f *GroupFilter) ApplyWithAlias(q *orm.Query, prefix string) (*orm.Query, error)

type Observation

type Observation struct {
	ID        int            `json:"id" gqlgen:"id"`
	Server    string         `pg:"unique:group_1,use_zero" json:"server" gqlgen:"server"`
	TribeID   int            `pg:"unique:group_1,use_zero" json:"tribeID" gqlgen:"tribeID"`
	Tribe     *twmodel.Tribe `pg:"-"`
	GroupID   int            `pg:"on_delete:CASCADE,unique:group_1,use_zero" json:"groupID" gqlgen:"groupID"`
	Group     *Group         `json:"group,omitempty" gqlgen:"group" pg:"rel:has-one"`
	CreatedAt time.Time      `pg:"default:now()" json:"createdAt" gqlgen:"createdAt" xml:"createdAt"`
	// contains filtered or unexported fields
}

type ObservationFilter

type ObservationFilter struct {
	ID      []int
	Server  []string
	GroupID []int
	DefaultFilter
}

func (*ObservationFilter) Apply

func (f *ObservationFilter) Apply(q *orm.Query) (*orm.Query, error)

func (*ObservationFilter) ApplyWithAlias

func (f *ObservationFilter) ApplyWithAlias(q *orm.Query, alias string) (*orm.Query, error)

type Observations

type Observations []*Observation

func (Observations) Contains

func (o Observations) Contains(server string, id int) bool

type Server

type Server struct {
	ID                string   `pg:",pk" json:"id" gqlgen:"id"`
	Lang              string   `pg:",use_zero"`
	CoordsTranslation string   `pg:",use_zero"`
	Groups            []*Group `pg:"rel:has-many"`
	// contains filtered or unexported fields
}

type ServerFilter

type ServerFilter struct {
	ID []string
	DefaultFilter
}

func (*ServerFilter) Apply

func (f *ServerFilter) Apply(q *orm.Query) (*orm.Query, error)

func (*ServerFilter) ApplyWithAlias

func (f *ServerFilter) ApplyWithAlias(q *orm.Query, alias string) (*orm.Query, error)

Jump to

Keyboard shortcuts

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