res

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterController

func RegisterController(v0 *server.V0, c Controller)

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(service *Service) Controller

func (*Controller) GetBackgroundByName

func (c *Controller) GetBackgroundByName(ctx *fiber.Ctx, name string, variantStr string) error

func (*Controller) GetBackgrounds

func (c *Controller) GetBackgrounds(ctx *fiber.Ctx) error

func (*Controller) GetImageByName

func (c *Controller) GetImageByName(ctx *fiber.Ctx, name string, variantStr string) error

func (*Controller) GetImages

func (c *Controller) GetImages(ctx *fiber.Ctx) error

type Resource

type Resource struct {
	Name string
	Path string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(conf *config.Config, repo *avg.VersionRepo) *Service

func (*Service) GetBackgroundByName

func (s *Service) GetBackgroundByName(ctx context.Context, name string, variant Variant) (*Resource, error)

func (*Service) GetBackgrounds

func (s *Service) GetBackgrounds(ctx context.Context) ([]Resource, error)

func (*Service) GetImageByName

func (s *Service) GetImageByName(ctx context.Context, name string, variant Variant) (*Resource, error)

func (*Service) GetImages

func (s *Service) GetImages(ctx context.Context) ([]Resource, error)

type Variant added in v0.5.0

type Variant struct {
	Key      string
	FileName func(base string) string
	Location func(base string, version string) string
}
var (
	Raw Variant = Variant{
		Key: "raw",
		FileName: func(base string) string {
			return fmt.Sprintf("%s.png", base)
		},
		Location: func(base string, version string) string {
			return filepath.Join(base, version, "raw")
		},
	}
	Thumbnail Variant = Variant{
		Key: "raw",
		FileName: func(base string) string {
			return fmt.Sprintf("%s.webp", base)
		},
		Location: func(base string, version string) string {
			return filepath.Join(base, version, "thumbnail")
		},
	}
)

func VariantFromString added in v0.5.0

func VariantFromString(str string) (Variant, error)

Jump to

Keyboard shortcuts

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