citizen

package
v0.0.0-...-82a996f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 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 (
	ServerAddress 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 CreateIndex

func CreateIndex() (err error)

CreateIndex creates an index associated to the id of the citizen on the MongoDB collection in order to make faster queries when searching for citizen information.

func CreateMongoPersistor

func CreateMongoPersistor()

Creates a MongoDB persistor to interact with the database

Types

type Address

type Address struct {
	Province string
	City     string
	District string
}

Address will contain the registered voting district of the citizen.

type Citizen

type Citizen struct {
	Identification string
	FirstName      string
	LastName       string
	SurName        string
	Gender         string
	Address        Address
}

Citizen represents a Costa Rican citizen.

func New

func New(id string) *Citizen

New creates a new empty Citizen with the provided identification All the other fields will be empty at first.

func (*Citizen) Create

func (citizen *Citizen) Create() (err error)

func (*Citizen) Delete

func (citizen *Citizen) Delete(cache skue.MemoryCacher) (err error)

func (*Citizen) List

func (citizen *Citizen) List() (results interface{}, err error)

func (*Citizen) Read

func (citizen *Citizen) Read(cache skue.MemoryCacher) (err error)

func (*Citizen) Update

func (citizen *Citizen) Update(cache skue.MemoryCacher) (err error)

Jump to

Keyboard shortcuts

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