Documentation
¶
Index ¶
- type MongoDB
- func (d *MongoDB) Create(ctx context.Context, data Note) (Note, error)
- func (d *MongoDB) Delete(ctx context.Context, id string) (Note, error)
- func (d *MongoDB) Get(ctx context.Context, id string) (Note, error)
- func (d *MongoDB) List(ctx context.Context, filter, sort string, tags []string) ([]Note, error)
- func (d *MongoDB) Tags(ctx context.Context) ([]string, error)
- func (d *MongoDB) Update(ctx context.Context, note Note) error
- type Note
- type NoteNoID
- type NotesDatabase
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
type Note ¶
type Note struct { ID primitive.ObjectID `bson:"_id" json:"id,omitempty"` Content string `bson:"content" json:"content"` Title string `bson:"title" json:"title"` Created int `bson:"created" json:"created,omitempty"` Updated int `bson:"updated" json:"updated,omitempty"` Tags []string `bson:"tags" json:"tags,omitempty"` Response *Response `bson:"api_response" json:"api_response,omitempty"` Error string `bson:"error" json:"error,omitempty"` }
type NotesDatabase ¶
type NotesDatabase interface { List(ctx context.Context, filter, sort string, tags []string) ([]Note, error) Get(ctx context.Context, id string) (Note, error) Create(ctx context.Context, data Note) (Note, error) Update(ctx context.Context, data Note) error Delete(ctx context.Context, id string) (Note, error) Tags(ctx context.Context) ([]string, error) }
var DB NotesDatabase
Click to show internal directories.
Click to hide internal directories.