database

package
v0.0.0-...-d59d7d1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 4 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotObjectIdHex = errors.New("Invalid ID")
)

Functions

This section is empty.

Types

type Database

type Database struct {
	Session *mgo.Session
}

func New

func New(uri string) *Database

func (*Database) GetPost

func (db *Database) GetPost(id string) (*models.Post, error)

func (*Database) GetPosts

func (db *Database) GetPosts(query []bson.M) ([]*models.Post, error)

func (*Database) GetUser

func (db *Database) GetUser(id string) (*models.User, error)

func (*Database) GetUsers

func (db *Database) GetUsers(query []bson.M) ([]*models.User, error)

func (*Database) SavePost

func (db *Database) SavePost(post *models.Post) (*models.Post, error)

func (*Database) SaveUser

func (db *Database) SaveUser(user *models.User) (*models.User, error)

Jump to

Keyboard shortcuts

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