database

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Close()

	Remove(id string)
	Add(...*entry.Entry) error

	GetTags() ([]string, error)
	Search(opt *QueryOptions, query string) ([]string, error)
	ByTag(opt *QueryOptions, tag string) ([]string, error)
	BySection(opt *QueryOptions, sections ...string) ([]string, error)
	ByDate(opts *QueryOptions, year, month, day int) ([]string, error)
}

func NewDatabase

func NewDatabase(cfg *config.PostgreSQL) (Database, error)

type Postgres

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

func (*Postgres) Add

func (d *Postgres) Add(entries ...*entry.Entry) error

func (*Postgres) ByDate

func (d *Postgres) ByDate(opts *QueryOptions, year, month, day int) ([]string, error)

func (*Postgres) BySection

func (d *Postgres) BySection(opts *QueryOptions, sections ...string) ([]string, error)

func (*Postgres) ByTag

func (d *Postgres) ByTag(opts *QueryOptions, tag string) ([]string, error)

func (*Postgres) Close

func (d *Postgres) Close()

func (*Postgres) GetTags

func (d *Postgres) GetTags() ([]string, error)

func (*Postgres) Remove

func (d *Postgres) Remove(id string)

func (*Postgres) Search

func (d *Postgres) Search(opts *QueryOptions, query string) ([]string, error)

type QueryOptions

type QueryOptions struct {
	Page    int
	Limit   int
	Draft   bool
	Deleted bool
	Private bool
}

Jump to

Keyboard shortcuts

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