mongo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host       string
	Port       int
	Database   string
	Collection string
}

Config struct for storing MongoDB client

type Note

type Note struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Tags        []string           `bson:"tags"`
	Command     string             `bson:"command"`
	Description string             `bson:"description"`
}

Note struct for storing notes in MongoDB

type Store

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

Store struct for storing MongoDB client/collection

func Initialize

func Initialize(config *Config) *Store

Initialize MongoDB client

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete a note by ID from MongoDB

func (*Store) DeleteByTags

func (s *Store) DeleteByTags(tags []string) error

DeleteByTags deletes notes by tags from MongoDB

func (*Store) Get

func (s *Store) Get(id string) (interface{}, error)

Get a note from MongoDB

func (*Store) GetAll

func (s *Store) GetAll() (interface{}, error)

GetAll gets all notes from MongoDB

func (*Store) GetByTags

func (s *Store) GetByTags(tags []string) (interface{}, error)

GetByTags gets notes by tags from MongoDB

func (*Store) GetTags

func (s *Store) GetTags() ([]string, error)

GetTags returns all available tags

func (*Store) Insert

func (s *Store) Insert(item interface{}) error

Insert a note into MongoDB

func (*Store) Search

func (s *Store) Search(searchWords []string, searchLocations []string) (interface{}, error)

Search for notes by tags, description or command from MongoDB

Jump to

Keyboard shortcuts

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