Documentation ¶
Index ¶
- Constants
- Variables
- func CheckKind(kind string) error
- func CheckVariant(variant string) error
- func NewRepo(db *bun.DB, conf *config.Config) (*repo, error)
- func RegisterController(v0 *server.V0, c *Controller)
- func SortAsset(query *bun.SelectQuery) *bun.SelectQuery
- func SortAssetVariant(query *bun.SelectQuery) *bun.SelectQuery
- func SortVariant(query *bun.SelectQuery) *bun.SelectQuery
- type Asset
- type Controller
- func (c *Controller) GetAsset(ctx *fiber.Ctx) error
- func (c *Controller) GetAssets(ctx *fiber.Ctx) error
- func (c *Controller) GetKindNames(ctx *fiber.Ctx) error
- func (c *Controller) GetVariant(ctx *fiber.Ctx) error
- func (c *Controller) GetVariantFile(ctx *fiber.Ctx) error
- func (c *Controller) GetVariantNames(ctx *fiber.Ctx) error
- func (c *Controller) GetVariants(ctx *fiber.Ctx) error
- func (c *Controller) PostVariant(ctx *fiber.Ctx) error
- type Service
- func (s *Service) GetAsset(ctx context.Context, kind, name string) (*Asset, error)
- func (s *Service) GetAssets(ctx context.Context, kind string) ([]Asset, error)
- func (s *Service) GetKindNames(ctx context.Context) ([]string, error)
- func (s *Service) GetVariant(ctx context.Context, kind string, name string, variant string) (*Variant, error)
- func (s *Service) GetVariantFile(ctx context.Context, kind, name, variant string) (*string, error)
- func (s *Service) GetVariantNames(ctx context.Context) ([]string, error)
- func (s *Service) GetVariants(ctx context.Context, kind string, name string) ([]Variant, error)
- func (s *Service) InitNames(ctx context.Context) error
- func (s *Service) PopulateFrom(ctx context.Context, dirPath string) error
- func (s *Service) PostVariant(ctx context.Context, kind, name string, variant Variant, file io.Reader) error
- type Variant
Constants ¶
View Source
const ( KindImages = "images" KindBackgrounds = "backgrounds" KindCharacters = "characters" VariantImg = "img" VariantTimg = "timg" VariantAlpha = "alpha" VariantRealEsrgan = "real-esrgan" VariantRealCugan = "real-cugan" )
Variables ¶
View Source
var ( Kinds = []string{ KindImages, KindBackgrounds, KindCharacters, } KindsMap = map[string]string{ KindImages: KindImages, KindBackgrounds: KindBackgrounds, KindCharacters: KindCharacters, } Variants = []string{ VariantImg, VariantTimg, VariantAlpha, VariantRealEsrgan, VariantRealCugan, } VariantsMap = map[string]string{ VariantImg: VariantImg, VariantTimg: VariantTimg, VariantAlpha: VariantAlpha, VariantRealEsrgan: VariantRealEsrgan, VariantRealCugan: VariantRealCugan, } )
View Source
var ( ErrInvalidKind = fmt.Errorf("invalid kind") ErrInvalidVariant = fmt.Errorf("invalid variant") )
View Source
var (
ErrExists = errors.New("asset: the asset or variant already exists.")
)
Functions ¶
func CheckVariant ¶ added in v0.10.0
func RegisterController ¶
func RegisterController(v0 *server.V0, c *Controller)
func SortAsset ¶ added in v0.10.0
func SortAsset(query *bun.SelectQuery) *bun.SelectQuery
func SortAssetVariant ¶ added in v0.12.0
func SortAssetVariant(query *bun.SelectQuery) *bun.SelectQuery
func SortVariant ¶ added in v0.10.0
func SortVariant(query *bun.SelectQuery) *bun.SelectQuery
Types ¶
type Asset ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(service *Service) *Controller
func (*Controller) GetAsset ¶ added in v0.8.0
func (c *Controller) GetAsset(ctx *fiber.Ctx) error
func (*Controller) GetAssets ¶ added in v0.8.0
func (c *Controller) GetAssets(ctx *fiber.Ctx) error
func (*Controller) GetKindNames ¶ added in v0.10.0
func (c *Controller) GetKindNames(ctx *fiber.Ctx) error
func (*Controller) GetVariant ¶ added in v0.10.0
func (c *Controller) GetVariant(ctx *fiber.Ctx) error
func (*Controller) GetVariantFile ¶ added in v0.10.0
func (c *Controller) GetVariantFile(ctx *fiber.Ctx) error
func (*Controller) GetVariantNames ¶ added in v0.10.0
func (c *Controller) GetVariantNames(ctx *fiber.Ctx) error
func (*Controller) GetVariants ¶ added in v0.8.0
func (c *Controller) GetVariants(ctx *fiber.Ctx) error
func (*Controller) PostVariant ¶ added in v0.10.0
func (c *Controller) PostVariant(ctx *fiber.Ctx) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) GetKindNames ¶ added in v0.10.0
func (*Service) GetVariant ¶ added in v0.10.0
func (*Service) GetVariantFile ¶ added in v0.10.0
func (*Service) GetVariantNames ¶ added in v0.10.0
func (*Service) GetVariants ¶ added in v0.8.0
func (*Service) PopulateFrom ¶ added in v0.10.0
type Variant ¶
type Variant struct { Variant string `json:"variant"` Filename string `json:"filename"` Asset *Asset `json:"-"` }
func (Variant) FilePath ¶ added in v0.10.0
FilePath returns the absolute path to the variant file.
This is a shortcut for filepath.Join(dir, v.Path()).
Click to show internal directories.
Click to hide internal directories.