models

package
v0.0.0-...-ba7b697 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COOKIE_NAME string = "battleboats-session"
)

Variables

View Source
var AppCookie = securecookie.New(hashKey, blockKey)

Functions

This section is empty.

Types

type Direction

type Direction uint
const (
	NORTH Direction = iota
	EAST
	SOUTH
	WEST
)

func (Direction) String

func (d Direction) String() string

type Enum

type Enum interface {
	// contains filtered or unexported methods
}

* Enum for ship direction

type GameBoard

type GameBoard struct {
}

type GamePlayer

type GamePlayer struct {
	Id    *int64  `json:"id,omitempty"`
	Ships *[]Ship `json:"ships,omitempty"`
}

type Json

type Json []map[string]interface{}

func (*Json) Scan

func (this *Json) Scan(src interface{}) error

func (*Json) Value

func (this *Json) Value() (driver.Value, error)

type Match

type Match struct {
	Id            *int64 `db:"match_id" json:"id,omitempty"`
	PlayerOneId   *int64 `db:"player_one_id" json:"player_one_id,omitempty"`
	PlayerTwoId   *int64 `db:"player_two_id" json:"player_two_id,omitempty"`
	MatchComplete *bool  `db:"match_complete" json:"match_complete,omitempty"`
}

type Player

type Player struct {
	Id       *int64  `db:"player_id" json:"id,omitempty"`
	Email    *string `db:"email_address" json:"email,omitempty"`
	Password *string `db:"password" json:"-"`
}

type PlayerSession

type PlayerSession struct {
	Id       string    `json:"id,omitempty"`
	PlayerId string    `json:"player_id,omitempty"`
	Expire   time.Time `json:"expire,omitempty"`
}

type Point

type Point struct {
	X *uint `json:"x,omitempty"`
	Y *uint `json:"y,omitempty"`
}

type Ship

type Ship struct {
	ShipType       *string    `json:"ship_type,omitempty"`
	Size           *int64     `json:"size,omitempty"`
	Hits           *[]bool    `json:"hits,omitempty"`
	Origin         *Point     `json:"origin,omitempty"`
	Orientation    *Direction `json:"orientation,omitempty"`
	Sight          *int64     `json:"-"`
	Range          *int64     `json:"-"`
	MoveCap        *int64     `json:"-"`
	IsUsingSpecial *bool      `json:"is_using_special,omitempty"`
}

type ShipEnum

type ShipEnum string
const (
	CARRIER    ShipEnum = "Carrier"
	BATTLESHIP ShipEnum = "Battleship"
	DESTROYER  ShipEnum = "Destroyer"
	SUBMARINE  ShipEnum = "Submarine"
	PATROL     ShipEnum = "Patrol Boat"
)

type Turn

type Turn struct {
	Id         *int64 `db:"turn_id" json:"id,omitempty"`
	MatchId    *int64 `db:"match_id" json:"match_id,omitempty"`
	PlayerId   *int64 `db:"player_id" json:"player_id,omitempty"`
	TurnNumber *int64 `db:"turn_number" json:"turn_number,omitempty"`
	Board      *Json  `db:"gameboard" json:"gameboard,omitempty"`
}

type TypeConverter

type TypeConverter struct{}

TypeConverter Interface for gorp

func (TypeConverter) FromDb

func (c TypeConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)

FromDb returns a CustomScanner appropriate for this type. This will be used to hold values returned from SELECT queries.

In particular the CustomScanner returned should implement a Binder function appropriate for the Go type you wish to convert the db value to

If bool==false, then no custom scanner will be used for this field.

func (TypeConverter) ToDb

func (c TypeConverter) ToDb(val interface{}) (interface{}, error)

ToDb converts val to another type. Called before INSERT/UPDATE operations

Jump to

Keyboard shortcuts

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