models

package
v0.0.0-...-ca64790 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

The MIT License (MIT)

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.

Index

Constants

This section is empty.

Variables

View Source
var (
	Address  string // The address to reach the MongoDB server
	Username string // The username to connect with the MongoDB server
	Password string // The password of the MongoDB user
	Database string // The name of the database to store the models

)

Functions

func CreateMongoPersistor

func CreateMongoPersistor()

Creates a MongoDB persistor to interact with the database

Types

type Player

type Player struct {
	Id          bson.ObjectId `json:"Id" bson:"_id"`
	FirstName   string
	LastName    string
	Nationality string
	Age         int
	Position    string
	Height      string
	Weight      string
	Foot        string
}

----------------------------------------------------------------------------

PLAYER

---------------------------------------------------------------------------- Player represents a soccer player.

func NewPlayer

func NewPlayer(id string) *Player

NewPlayer creates a new empty Player object with the provided id. All the other fields will be empty at first.

func (*Player) Collection

func (player *Player) Collection() string

func (*Player) Create

func (player *Player) Create() (err error)

func (*Player) Delete

func (player *Player) Delete(cache skue.MemoryCacher) (err error)

func (*Player) List

func (player *Player) List() (results interface{}, err error)

func (*Player) Read

func (player *Player) Read(cache skue.MemoryCacher) (err error)

func (*Player) Update

func (player *Player) Update(cache skue.MemoryCacher) (err error)

type Team

type Team struct {
	TeamId       string
	Name         string
	CompleteName string
	Country      string
	Founded      int
	Website      string
	Players      []Player
}

----------------------------------------------------------------------------

TEAM

---------------------------------------------------------------------------- Team represents a soccer team.

func NewTeam

func NewTeam(id string) *Team

NewPlayer creates a new empty Player object with the provided id. All the other fields will be empty at first.

func (*Team) Collection

func (team *Team) Collection() string

func (*Team) Create

func (team *Team) Create() (err error)

func (*Team) Delete

func (team *Team) Delete(cache skue.MemoryCacher) (err error)

func (*Team) List

func (team *Team) List() (results interface{}, err error)

func (*Team) Read

func (team *Team) Read(cache skue.MemoryCacher) (err error)

func (*Team) Update

func (team *Team) Update(cache skue.MemoryCacher) (err error)

Jump to

Keyboard shortcuts

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