mongodb

package
v0.0.0-...-4440d16 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostModel

type PostModel struct {
	C *mongo.Collection
}

func (*PostModel) Create

func (m *PostModel) Create(post *models.Post) (*mongo.InsertOneResult, error)

Create a new post

func (*PostModel) GetAll

func (m *PostModel) GetAll() ([]models.Post, error)

Get all posts

func (*PostModel) GetAllByUser

func (m *PostModel) GetAllByUser(userID string) ([]models.Post, error)

Get all posts by a user

func (*PostModel) GetById

func (m *PostModel) GetById(id string) (*models.Post, error)

Get a post by its ID

func (*PostModel) GetByTitle

func (m *PostModel) GetByTitle(title string) (*models.Post, error)

Get a post by title

Jump to

Keyboard shortcuts

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