storage

package
v0.0.0-...-18d4f34 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PageSize = 5

TODO: PageSize is hard coded now, but should be made variable later <2024-01-05, Jesse Dearing> PageSize is the number of services per page.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	DB *pgxpool.Pool
	ServiceStorage
}

func New

func New(connpool *pgxpool.Pool) *DB

New creates a new PostgresDB object

func (*DB) All

func (d *DB) All(ctx context.Context, page int) ([]*model.Service, error)

All will return the number of serices for the page number specified by the `page` parameter

func (*DB) FindByID

func (d *DB) FindByID(ctx context.Context, id uuid.UUID) (*model.Service, error)

func (*DB) FindByName

func (d *DB) FindByName(ctx context.Context, name string) ([]*model.Service, error)

func (*DB) SearchAll

func (d *DB) SearchAll(ctx context.Context, query string) ([]*model.Service, error)

type ServiceStorage

type ServiceStorage interface {
	All(ctx context.Context, page int) ([]model.Service, error)
	FindByID(ctx context.Context, id uuid.UUID) (*model.Service, error)
	FindByName(ctx context.Context, name string) ([]*model.Service, error)
	SearchAll(ctx context.Context, query string) ([]*model.Service, error)
}

Jump to

Keyboard shortcuts

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