service

package
v0.0.0-...-f25d604 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotesService

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

NotesService implements Service with store

func NewNotesService

func NewNotesService(st store.Store, lg *zap.Logger) NotesService

NewNotesService creates a new instance of NotesService

func (NotesService) Create

func (n NotesService) Create(id string, data db.Data) error

Create creates a new record in DB, handling translations

func (NotesService) Delete

func (n NotesService) Delete(id string) error

Delete deletes the data corresponding to id in store handing translations and deleting nothing

func (NotesService) Exists

func (n NotesService) Exists(id string) (bool, error)

Exists gets data with id from DB, checks it against zero values and returns true if the record is non-zero

func (NotesService) Get

func (n NotesService) Get(id string) (db.Data, error)

Get fetches the data corresponding to id in store and returns a db data, handling translations

func (NotesService) Update

func (n NotesService) Update(id string, data db.Data) error

Update updates records in DB, handling translations

type Service

type Service interface {
	Create(id string, data db.Data) error
	Update(id string, data db.Data) error
	Exists(id string) (bool, error)
	Delete(id string) error
	Get(id string) (db.Data, error)
}

Service Interface defines a service spec

Jump to

Keyboard shortcuts

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