internal

package
v0.0.0-...-d00e03a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertResolutionFormString

func ConvertResolutionFormString(resolution, delimiter string) (int, int, error)

func StartServer

func StartServer(imageManager ImageService) error

Types

type Cache

type Cache interface {
	GetImages(resolution string) ([][]byte, error)
	CacheImage(imageData []byte, imageName string) error
}

type Config

type Config struct {
	RedisURL       string `env:"redis_server"`
	RedisDatabase  int    `env:"redis_db"`
	RedisPort      int    `env:"redis_port"`
	RedisPassword  string `env:"redis_password"`
	RedditUsername string `env:"reddit_username"`
	RedditPassword string `env:"reddit_password"`
	RedditAppID    string `env:"reddit_client_id"`
	RedditSecret   string `env:"reddit_client_secret"`
}

func GetConfig

func GetConfig() (*Config, error)

type ImageEntry

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

type ImageService

type ImageService interface {
	GetImage(animal string, width, height int) ([]byte, error)
}

type PlaceItGoHandler

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

type RedditService

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

func NewRedditService

func NewRedditService(config *Config, cache *RedisCache) (*RedditService, error)

func (RedditService) GetImage

func (r RedditService) GetImage(animal string, width, height int) ([]byte, error)

type RedisCache

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

func NewRedisCache

func NewRedisCache(cfg *Config) (*RedisCache, error)

func (RedisCache) GetImage

func (r RedisCache) GetImage(width, height int, animal string) (ImageEntry, error)

func (RedisCache) SaveImage

func (r RedisCache) SaveImage(width, height int, authorName, title, animal, imageLink string) error

Jump to

Keyboard shortcuts

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