goker

package module
v0.0.0-...-6299238 Latest Latest
Warning

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

Go to latest
Published: May 11, 2014 License: MIT Imports: 10 Imported by: 0

README

Goker

Go backend of poker games management

Configuration

Copy the file config.gcfg.sample to config.gcfg and configure your installation (database settings).

Licence

The MIT License (MIT)

Copyright (c) 2014 NeuronalMotion

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Index

Constants

View Source
const GameTypeCashGame = "cashgame"
View Source
const GameTypeSitAndGo = "sitandgo"

Variables

This section is empty.

Functions

func DBClear

func DBClear()

func DBClose

func DBClose()

func DBDefaultData

func DBDefaultData()

Init default database by dropping recreating tables with default data

func FillCupData

func FillCupData(cup *Cup)

func HandleArgs

func HandleArgs()

func HttpHandler

func HttpHandler() (h *rest.ResourceHandler)

Types

type Config

type Config struct {
	Database struct {
		Name     string
		User     string
		Password string
	}
	App struct {
		Host      string
		Port      int
		UrlPrefix string
	}
}

Configuration flag data

func (*Config) Addr

func (c *Config) Addr() string

type Cup

type Cup struct {
	Id        int64  `json:"id"`
	Name      string `json:"name" sql:"size:255"`
	Type      string `json:"type" sql:"not null"`
	OwnerId   int64  `json:"-"`
	Owner     User
	Users     []User
	Games     []Game
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

func DBGetCupsForUser

func DBGetCupsForUser(userId int64) []Cup

func (*Cup) Delete

func (u *Cup) Delete(w rest.ResponseWriter, r *rest.Request)

func (*Cup) Get

func (u *Cup) Get(w rest.ResponseWriter, r *rest.Request)

func (*Cup) GetAll

func (u *Cup) GetAll(w rest.ResponseWriter, r *rest.Request)

func (*Cup) Post

func (u *Cup) Post(w rest.ResponseWriter, r *rest.Request)

func (*Cup) Put

func (u *Cup) Put(w rest.ResponseWriter, r *rest.Request)

type Game

type Game struct {
	Id     int64  `json:"id"`
	Type   string `json:"type" sql:"not null"`
	CupId  int64  `json:"cupId"`
	Cup    Cup    `json:"-"`
	Users  []User
	Scores []Score
}

func DBGetGamesForUser

func DBGetGamesForUser(userId int64) []Game

type GokerContext

type GokerContext struct {
	Cfg Config
	DB  gorm.DB
}
var GokerCtx GokerContext

type Score

type Score struct {
	Id            int64   `json:"id"`
	UserId        int64   `json:"userId"`
	Type          string  `json:"type" sql:"not null"`
	CashGameScore float64 `json:"value,omitempty"`
	SitAndGoScore int32   `json:"value,omitempty"`
}

type User

type User struct {
	Id        int64     `json:"id"`
	Login     string    `json:"login" sql:"size:255;unique"`
	Password  string    `json:"-" sql:"size:255"`
	Email     string    `json:"email" sql:"type:varchar(100)"`
	Name      string    `json:"name" sql:"size:255"`
	Cups      []Cup     `json:"-"`
	Games     []Game    `json:"-"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	DeletedAt time.Time `json:"-"`
}

func DBGetUsersForCup

func DBGetUsersForCup(cupId int64) []User

func DBGetUsersForGame

func DBGetUsersForGame(gameId int64) []User

func (*User) Delete

func (u *User) Delete(w rest.ResponseWriter, r *rest.Request)

func (*User) Get

func (u *User) Get(w rest.ResponseWriter, r *rest.Request)

func (*User) GetAll

func (u *User) GetAll(w rest.ResponseWriter, r *rest.Request)

func (*User) GetCups

func (u *User) GetCups(w rest.ResponseWriter, r *rest.Request)

func (*User) Post

func (u *User) Post(w rest.ResponseWriter, r *rest.Request)

func (*User) Put

func (u *User) Put(w rest.ResponseWriter, r *rest.Request)

type UserCup

type UserCup struct {
	Id     int64
	UserId int64
	User   User
	CupId  int64
	Cup    Cup
}

type UserGame

type UserGame struct {
	Id     int64
	UserId int64
	User   User
	GameId int64
	Game   Game
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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