common

package
v0.0.0-...-6fe8c32 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxUploadBytes    = 5 * 1024 * 1024
	MaxImageDimension = 4000
)

Variables

This section is empty.

Functions

func NewPaginationQuery

func NewPaginationQuery(limit, offset int) map[string]interface{}

func NewSearchPaginationQuery

func NewSearchPaginationQuery(q string, limit, offset int) map[string]interface{}

func NewSearchQuery

func NewSearchQuery(q string) map[string]interface{}

func ValidateImage

func ValidateImage(name string, data []byte) (string, error)

ValidateImage ensures arbitrary image data matches platform requirements.

Types

type LimitOffset

type LimitOffset struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

type Photo

type Photo struct {
	PhotoData   []byte `json:"-"`
	PhotoName   string `json:"-"`
	ContentType string `json:"-"`
}

func NewPhotoFromFile

func NewPhotoFromFile(path string) (Photo, error)

func NewPhotoFromReader

func NewPhotoFromReader(r io.Reader, name string) (Photo, error)

func (*Photo) FromBytes

func (p *Photo) FromBytes(data []byte, name string) error

func (*Photo) FromFile

func (p *Photo) FromFile(photoPath string) error

func (*Photo) FromReader

func (p *Photo) FromReader(r io.Reader, name string) error

func (*Photo) Validate

func (p *Photo) Validate() error

func (*Photo) WriteToMultipart

func (p *Photo) WriteToMultipart(w *multipart.Writer, field string) error

Jump to

Keyboard shortcuts

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