model

package
v0.0.0-...-38d2dd1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	ImagesDir() string
	ImgURLRoot() string
	DefaultFolderName() string
}

type DB

type DB interface {
	SaveMeta(ImageMeta) (int64, error)
	DeleteMeta(int64) error
}

type FileWriter

type FileWriter interface {
	WriteFile(fileName string, data []byte, perm os.FileMode) error
}

type ImageMeta

type ImageMeta struct {
	ID       string
	UserID   string
	Width    int
	Height   int
	Type     string
	MimeType string
	// contains filtered or unexported fields
}

type JWTClaim

type JWTClaim struct {
	UsrID string
	jwt.StandardClaims
}

type Model

type Model struct {
	errors.ErrToHTTP
	// contains filtered or unexported fields
}

func New

func New(c Config, tv TokenValidator, db DB, fw FileWriter) (*Model, error)

func (*Model) NewBase64Image

func (m *Model) NewBase64Image(token, folder, imgStr string) (time.Time, string, error)

func (*Model) NewImage

func (m *Model) NewImage(token, folder string, r io.ReadCloser) (time.Time, string, error)

type TokenValidator

type TokenValidator interface {
	Validate(JWT string) (*JWTClaim, error)
	errors.IsAuthErrChecker
}

Jump to

Keyboard shortcuts

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