models

package
v0.0.0-...-f6c7002 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2014 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Packate models defines types and methods used to interact with user input data and data associated with a table in the DB

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Id       int    // Database primary key. AutoIncrement value
	User     *User  `orm:"rel(fk);index"` // Indexed Foreign Key -> User.Id
	Txt      string `orm:"size(4096)"`
	Category uint8  // Indicates page used to post the comment
	Archived bool
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
}

Comment struct used to read and write to DB table "comment" see const category in home.go for Category codes

func (*Comment) Insert

func (cmnt *Comment) Insert() error

Comment database access methods include Insert and Read TODO Add Archive and review need for Delete

func (*Comment) Read

func (cmnt *Comment) Read(fields ...string) error

type RegFrm

type RegFrm struct {
	Email    string `form:"email"`
	Username string `form:"username"`
	Fullname string `form:"fullname"`
	Password string `form:"pw1"`
	Confirm  string `form:"pw2"`
	AutoLog  string `form:"autolog"`
}

RegFrm struct to hold Registration page and Profile page form values

type User

type User struct {
	Id       int       // Database primary key. AutoIncrement value
	Username string    `orm:"size(30);unique"`
	Fullname string    `orm:"size(60)"`
	Email    string    `orm:"size(256)"` // encoded email address
	Password string    `orm:"size(128)"` // password hash value
	AutoLog  bool      // true if user selected "Remember Me"
	Interest uint8     // User's primary interest as a category code
	RegKey   string    `orm:"size(60)"` // used to confirm registration email
	ResetKey string    `orm:"size(60)"` // used to confirm password reset
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
	Updated  time.Time `orm:"auto_now;type(datetime)"`
}

User struct used to read and write to DB table "users" see const category in home.go for Interest codes

func (*User) Delete

func (usr *User) Delete() error

func (*User) Insert

func (usr *User) Insert() error

User database CRUD methods include Insert, Read, Update and Delete

func (*User) Read

func (usr *User) Read(fields ...string) error

func (*User) Update

func (usr *User) Update(fields ...string) error

Jump to

Keyboard shortcuts

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