book

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteNote

func DeleteNote(ctx context.Context, filter bson.D) (*mongo.DeleteResult, error)

func UpdateNote

func UpdateNote(ctx context.Context, filter bson.D, note *Note) (*mongo.UpdateResult, error)

Types

type Note

type Note struct {
	ID          primitive.ObjectID `json:"id" bson:"_id"`
	UUID        string             `json:"uuid"`
	Title       string             `json:"title"`
	Description string             `json:"description"`
	Content     string             `json:"content"`
	Authors     []string           `json:"authors"`
	Topics      []string           `json:"topics"`
	Tags        []string           `json:"tags"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	PublishedAt time.Time          `json:"published_at"`
}

func CreateNote

func CreateNote(n *Note) (*Note, error)

func FindNote

func FindNote(ctx context.Context, filter bson.D) (*Note, error)

func FindNotes

func FindNotes(ctx context.Context, filter bson.D) ([]Note, error)

func (*Note) AssignID

func (n *Note) AssignID()

func (*Note) AssignUUID

func (n *Note) AssignUUID()

func (*Note) InitialDates

func (n *Note) InitialDates()

func (*Note) Merge

func (n *Note) Merge(reqNote Note)

func (*Note) TouchUpdatedAt

func (n *Note) TouchUpdatedAt()

Jump to

Keyboard shortcuts

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