database

package
v0.0.0-...-d98f53d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToDB

func ConnectToDB() (*mongo.Database, error)

Types

type Post

type Post struct {
	ID        primitive.ObjectID    `bson:"_id,omitempty" json:"id,omitempty"`
	Timestamp primitive.Timestamp   `bson:"timestamp,omitempty" json:"timestamp,omitempty"`
	Author    string                `bson:"author,omitempty" json:"author,omitempty"`
	Message   string                `bson:"message,omitempty" json:"message,omitempty"`
	Tags      []string              `bson:"tags,omitempty" json:"tags,omitempty"`
	Shared    []primitive.DBPointer `bson:"shared,omitempty" json:"shared,omitempty"`
}

type PostStore

type PostStore struct {
	// contains filtered or unexported fields
}

func NewPostStore

func NewPostStore(db *mongo.Database) *PostStore

func (*PostStore) Create

func (s *PostStore) Create(post *Post) (*mongo.InsertOneResult, error)

func (*PostStore) Delete

func (s *PostStore) Delete(id primitive.ObjectID) (*mongo.DeleteResult, error)

func (*PostStore) Get

func (s *PostStore) Get(id primitive.ObjectID) (*Post, error)

func (*PostStore) ListAll

func (s *PostStore) ListAll() (*[]Post, error)

Jump to

Keyboard shortcuts

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