models

package
v0.0.0-...-f483e03 Latest Latest
Warning

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

Go to latest
Published: May 15, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoPosts

func GoPosts() *goPosts

func GoSessions

func GoSessions() *goSessions

func GoUsers

func GoUsers() *goUsers

func OpenDB

func OpenDB(source string) *sql.DB

OpenDB ..

Types

type Post

type Post struct {
	ID         string
	PostedByID string
	PostDate   int64
	ReplyCount int
	Replies    map[string][]string // map[By]With
}

Post is a struct that represents a specific post's infomation in Go

type Posts

type Posts interface {
	Store(post *Post) error
	Update(post *Post) error
	Delete(id string) error

	ByID(id string) (*Post, error)
	ByUser(uid string) ([]*Post, error)
}

Posts deals with the storage of posts aswell as the retrival by certain criteria

func SQLPosts

func SQLPosts(db *sql.DB) Posts

SQLPosts ..

type Session

type Session struct {
	SID string
	UID string
}

Session is a struct that represents Session data from the db

type Sessions

type Sessions interface {
	Store(sess *Session) error
	Delete(sid string) error

	GetSession(sid string) (*Session, error)
}

Sessions ...

func SQLSessions

func SQLSessions(db *sql.DB) Sessions

SQLSessions ..

type User

type User struct {
	ID             string
	Username       string
	HashedPassword []byte
	Email          string
	Name           string
	Description    string
	PostCount      int
}

User represents a specific user's infomation

func (*User) CheckPassword

func (u *User) CheckPassword(password string) bool

CheckPassword checks a plain string password against User's hashed password

type Users

type Users interface {
	Store(user *User) error
	Update(user *User) error
	Delete(id string) error

	ByID(id string) (*User, error)
	ByUsername(username string) (*User, error)
}

Users ...

func SQLUsers

func SQLUsers(db *sql.DB) Users

SQLUsers ..

Jump to

Keyboard shortcuts

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