Documentation
¶
Overview ¶
Package postgres provides a postgresql implementation of the repository.Repository.
Index ¶
- type Options
- type Repository
- func (r *Repository) CreateWord(ctx context.Context, w repository.Word) (repository.WordID, error)
- func (r *Repository) DeleteWord(ctx context.Context, id repository.WordID) error
- func (r *Repository) SearchTranslation(ctx context.Context, query string) ([]repository.TranslatedWord, error)
- func (r *Repository) SearchWord(ctx context.Context, query string) (*repository.Word, error)
- func (r *Repository) Word(ctx context.Context, id repository.WordID) (*repository.Word, error)
- func (r *Repository) WordRoot(ctx context.Context, root string) (*repository.WordRoot, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // DBName is the name of the database to use. // // It must exist. // // It is required. DBName string // Host is the host of the database. // // It is required. Host string // User is the username to use. // // It is required. User string // Password is the password to use. // // It is required. Password string // Logger is the logger used to log sql queries. Logger *zap.SugaredLogger }
Options contains the options used to configure the repository.
type Repository ¶
func Open ¶
func Open(o Options) (*Repository, error)
func (*Repository) CreateWord ¶
func (r *Repository) CreateWord(ctx context.Context, w repository.Word) (repository.WordID, error)
func (*Repository) DeleteWord ¶
func (r *Repository) DeleteWord(ctx context.Context, id repository.WordID) error
func (*Repository) SearchTranslation ¶
func (r *Repository) SearchTranslation(ctx context.Context, query string) ([]repository.TranslatedWord, error)
func (*Repository) SearchWord ¶
func (r *Repository) SearchWord(ctx context.Context, query string) (*repository.Word, error)
func (*Repository) Word ¶
func (r *Repository) Word(ctx context.Context, id repository.WordID) (*repository.Word, error)
func (*Repository) WordRoot ¶
func (r *Repository) WordRoot(ctx context.Context, root string) (*repository.WordRoot, error)
Click to show internal directories.
Click to hide internal directories.