Documentation ¶
Overview ¶
Package art provides functionalities related to Art and Variant of the game, including serving them, manipulating them and keep them persisted.
This package exposes its main interfaces by fx via FxModule function. However, it is still easy to instantiate an art.Service by simply creating it.
Index ¶
- Constants
- Variables
- func FxModule() fx.Option
- type Art
- type Service
- func (s *Service) SelectArt(id string) (*Art, error)
- func (s *Service) SelectArts(category *string) ([]*Art, error)
- func (s *Service) SelectArtsWhoseVariantAbsent(variation string) ([]*Art, error)
- func (s *Service) SelectVariant(id string, kind string) (*Variant, error)
- func (s *Service) SelectVariants(id string) ([]*Variant, error)
- func (s *Service) StoreStatics(statics ...*VariantContent) error
- func (s *Service) TakeStatics(statics ...*VariantContent) error
- func (s *Service) UpsertArts(arts ...*Art) error
- func (s *Service) UpsertVariants(variants ...*Variant) error
- type Variant
- type VariantContent
Constants ¶
View Source
const ( CategoryImage string = "image" CategoryBackground string = "background" CategoryItem string = "item" CategoryCharacter string = "character" )
View Source
const ( VariationOrigin string = "origin" VariationThumbnail string = "thumbnail" VariationRealEsrgan string = "real-esrgan" )
Variables ¶
View Source
var (
ErrNotFound = errors.New("the resource with the identifier(s) is not found")
)
Functions ¶
Types ¶
type Art ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) SelectArtsWhoseVariantAbsent ¶
func (*Service) SelectVariant ¶
func (*Service) StoreStatics ¶
func (s *Service) StoreStatics(statics ...*VariantContent) error
func (*Service) TakeStatics ¶
func (s *Service) TakeStatics(statics ...*VariantContent) error
func (*Service) UpsertArts ¶
func (*Service) UpsertVariants ¶
type Variant ¶
type Variant struct { ArtID string `gorm:"primaryKey;type:text COLLATE numeric" json:"artID"` Variation string `gorm:"primaryKey" json:"variation,omitempty"` ContentPresent bool `gorm:"" json:"contentPresent,omitempty"` ContentPath string `gorm:"" json:"contentPath,omitempty"` ContentWidth *int `gorm:"" json:"contentWidth,omitempty"` ContentHeight *int `gorm:"" json:"contentHeight,omitempty"` }
func NewVariant ¶
func (*Variant) ToStatic ¶
func (v *Variant) ToStatic() *VariantContent
type VariantContent ¶
type VariantContent struct { ArtID string `params:"id"` Variation string `params:"variation"` Content []byte }
VariantContent helps store and take the content of a variant to or from the filesystem.
func (*VariantContent) Path ¶
func (s *VariantContent) Path(root string) string
func (*VariantContent) PathRel ¶
func (s *VariantContent) PathRel() string
func (*VariantContent) String ¶
func (s *VariantContent) String() string
Click to show internal directories.
Click to hide internal directories.