Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MovementValidator validator.Func = func(fl validator.FieldLevel) bool { rule := regexp.MustCompile(`^\w+(\s+\w+)*$`) matches := rule.FindAllString(fl.Field().String(), -1) return len(matches) == 1 }
MovementValidator validates the movement field in a Set. Returns true if valid, else false.
Functions ¶
func BindingErrorToMessage ¶
BindingErrorToMessage turns a binding error from a set field into a a readable message on the field's constraints.
func ContainsSet ¶
ContainsSet checks if the slice of sets contains the provided set.
func ContainsUser ¶
ContainsUser checks if the slice of users contains the provided user.
func SetsEqual ¶
SetsEqual returns true if all non-id fields of the set are equal, and false otherwise.
func UsersEqual ¶
UsersEqual returns true if all non-id fields of the user are equal, and false otherwise.
Types ¶
type Credentails ¶
type Set ¶
type Set struct { // the id for this set // // required: true // min: 1 ID SetID `json:"set-id"` UID UserID `json:"user-id,omitempty"` Movement string `json:"movement" binding:"movement"` Volume float64 `json:"volume" binding:"gt=0"` Intensity float64 `json:"intensity" binding:"gt=0,lte=100"` CreatedOn string `json:"-"` LastUpdatedOn string `json:"-"` }
Set is the model representation of a sets resource swagger:model
type SetID ¶
type SetID int
SetID is the unique int identifier assigned to sets when added to the SetDB
Click to show internal directories.
Click to hide internal directories.