models

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

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

Go to latest
Published: Oct 25, 2017 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLat = errors.New("Latitude must be between -90 and 90 degrees")
	ErrInvalidLon = errors.New("Longitude must be between -180 and 180 degrees")
)
View Source
var (
	ErrInvalidName   = errors.New("Name must be at least 3 characters")
	ErrInvalidRadius = errors.New("Radius must be greater than 0 miles")
)

Functions

This section is empty.

Types

type Point

type Point struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

func (*Point) Validate

func (p *Point) Validate() error

type PostedRoom

type PostedRoom struct {
	Name        string `json:"name" gorm:"unique_index"`
	Coordinates Point  `json:"coordinates"`
}

func (*PostedRoom) Validate

func (r *PostedRoom) Validate() error

type PostedUser

type PostedUser struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (*PostedUser) HashPassword

func (u *PostedUser) HashPassword() error

func (*PostedUser) Validate

func (u *PostedUser) Validate() error

type Room

type Room struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name" gorm:"unique_index"`
	UserID    int64     `json:"user_id"`
	Lat       float64   `json:"lat"`
	Lon       float64   `json:"lon"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type RoomQuery

type RoomQuery struct {
	Coordinates Point   `json:"coordinates"`
	Radius      float64 `json:"radius"`
}

func (*RoomQuery) Validate

func (r *RoomQuery) Validate() error

type User

type User struct {
	ID        int64     `json:"id"`
	Email     string    `json:"email" gorm:"unique_index"`
	Password  string    `json:"-"`
	Admin     bool      `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*User) CheckPassword

func (u *User) CheckPassword(password string) bool

type UserClaims

type UserClaims struct {
	ID    int64
	Email string
	Admin bool
}

Jump to

Keyboard shortcuts

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