controllers

package
v0.0.0-...-ed4daf5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CANVAS_SIZE = 3
)

Variables

This section is empty.

Functions

func GetCanvas

func GetCanvas(c *gin.Context)

getCanvas returns the whole redis bitfield as a byte array.

func GetSquareByLocation

func GetSquareByLocation(c *gin.Context)

getSquareByLocation returns a single square given X and Y coordinates.

func GetSquares

func GetSquares(c *gin.Context)

getSquares responds with the list of all squares as JSON.

func PutSquare

func PutSquare(c *gin.Context)

putSquare creates a square object in the db.

Types

type Square

type Square struct {
	X         int    `json:"x" bson:"x" binding:"gte=0"`
	Y         int    `json:"y" bson:"y" binding:"gte=0"`
	Color     byte   `json:"color" bson:"color" binding:"required,lt=16"`
	Author    string `json:"author" bson:"author" binding:"required"`
	Timestamp int64  `json:"timestamp,omitempty" bson:"timestamp"`
}

Jump to

Keyboard shortcuts

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