services

package
v0.0.0-...-92393ad Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JPEG = "image/jpeg"
	PNG  = "image/png"
)

Define some macro constants

Variables

This section is empty.

Functions

func AwardPoints

func AwardPoints(uuid string, points int) error

AwardPoints gives points to a user

func CreateUser

func CreateUser(u *models.User, password string) (int, error)

CreateUser creates a new user in the database Returns a http status code and possibly an error

func GetActiveImagesWithAssociatedUsers

func GetActiveImagesWithAssociatedUsers(page, amount int) (int, []*models.ManifestEntry, *dbmdl.Pagination)

GetActiveImagesWithAssociatedUsers returns a manifest of images

func GetLeaderboard

func GetLeaderboard(a int) []*models.LeaderboardEntry

GetLeaderboard returns a leaderboard ordered by points desc

func GetUUID

func GetUUID(r *http.Request) (string, error)

GetUUID can be used to find a UUID from a request

func GetUser

func GetUser(uuid string) *models.User

GetUser returns a user form the database

func GetUserImages

func GetUserImages(uuid string, page, amount int) (int, []*models.Image, *dbmdl.Pagination)

GetUserImages returns a manifest of images uploaded by a single user, active or not

func GuessImage

func GuessImage(uuidUser, uuidImage string, coords *models.Coordinates) bool

GuessImage checks whether the image was guessed correctrly

func ParseImage

func ParseImage(file []byte) (*image.Image, error)

ParseImage treats a file as an image

func VerifyFileType

func VerifyFileType(f []byte, types ...string) bool

VerifyFileType checks whether a file type is what we expect

func VerifyImageSize

func VerifyImageSize(img *image.Image, width int, height int) bool

VerifyImageSize verified whether an image is of proper size (px)

func WriteImage

func WriteImage(w io.Writer, img *image.Image, encoding string) (string, error)

WriteImage will create a buffer that can be written as a reply

Types

This section is empty.

Jump to

Keyboard shortcuts

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