env

package
v0.0.0-...-d1d1260 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Age

func Age(birthday time.Time) int

func HttpString

func HttpString(date time.Time) string

Types

type Env

type Env struct {
	Db  datastore
	Log *log.Logger
}

Env represents the environment that is needed to respond to http queries

func New

func New() *Env

New enviornment which allows for database calls

func (*Env) ConnectDb

func (env *Env) ConnectDb(sqlOpt SQLOptions, redisOpt RedisOptions)

ConnectDb connects the env to the sql database with the sqlOpt and the redis database with redisOpt

type Game

type Game struct {
	Selector

	ID uint

	HomeTeam *Team
	AwayTeam *Team
	Location string
	Time     time.Time
}

type Gender

type Gender int8
const (
	Male           Gender = 0
	Female         Gender = 1
	Other          Gender = 2
	PreferNotToSay Gender = 3
)

func ToGender

func ToGender(st string) Gender

func (Gender) String

func (g Gender) String() string

type Organizer

type Organizer struct {
	*User
	Rank
}

type Player

type Player struct {
	User
	Rank
}

type Rank

type Rank int
const (
	Member  Rank = 0
	Manager Rank = 1
)

func ToRank

func ToRank(st string) Rank

func (Rank) String

func (r Rank) String() string

type RedisOptions

type RedisOptions struct {
	Password string
	Host     string
	Port     int
}

RedisOptions lets you define the parameters to connect to a redis database

type SQLOptions

type SQLOptions struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}

SQLOptions lets you define the parameters to connect to a sql database

func (SQLOptions) String

func (s SQLOptions) String() string

String returns a string representation of a sql options

type Selector

type Selector struct {
	// contains filtered or unexported fields
}

Selectable allows a struct to be selectable in a database

func (Selector) String

func (s Selector) String() string

Selector returns the structs selector

type Team

type Team struct {
	Selector

	ID           uint
	TournamentID uint

	Name    string
	Players []*Player
}

type Tournament

type Tournament struct {
	Selector
	ID uint

	Name       string
	Owner      *Organizer
	Organizers []*Organizer
	Teams      []*Team
}

type User

type User struct {
	Selector

	ID uint

	Email     string
	FirstName string
	LastName  string

	Gender      Gender
	DateOfBirth time.Time
}

Jump to

Keyboard shortcuts

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