models

package
v0.0.0-...-357f5c8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2015 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MessagePageSize = 20
	MinOffset       = 0
)

Variables

View Source
var DB *runner.DB

DB is the database instance used be the models

Functions

func Init

func Init(user, pass, service, port, name string)

Init creates a new connection to a database

Types

type Message

type Message struct {
	ID      int64  `db:"id" json:"id"`
	Content string `db:"message" json:"content"`
	User    string `db:"username" json:"user"`
	Key     string `db:"channel_key" json:"channel_key"`
	Time    int64  `db:"time" json:"time"`
}

func Messages

func Messages(key string, page int64) ([]Message, error)

func NewMessage

func NewMessage(content, user, key string) (Message, error)

type User

type User struct {
	ID       int64  `db:"id" json:"id"`
	Username string `db:"username" json:"username"`
	Password string `db:"password" json:"-"`
	Email    string `db:"email" json:"email"`
}

User is someone with an account on Big Room

func FetchUser

func FetchUser(key string, value interface{}) (User, error)

FetchUser retrieves a user given a value and key

func NewUser

func NewUser(username, password, email string) (User, error)

NewUser registers a new user

func (User) Login

func (u User) Login(password string) error

Login verifies that the provided password is correct

Jump to

Keyboard shortcuts

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