homedb

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package homedb contains home related CRUD functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store manages the set of APIs for home database access.

func NewStore

func NewStore(log *logger.Logger, db *sqlx.DB) *Store

NewStore constructs the api for data access.

func (*Store) Count

func (s *Store) Count(ctx context.Context, filter home.QueryFilter) (int, error)

Count returns the total number of homes in the DB.

func (*Store) Create

func (s *Store) Create(ctx context.Context, hme home.Home) error

Create inserts a new home into the database.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, hme home.Home) error

Delete removes a home from the database.

func (*Store) ExecuteUnderTransaction

func (s *Store) ExecuteUnderTransaction(tx transaction.Transaction) (home.Storer, error)

ExecuteUnderTransaction constructs a new Store value replacing the sqlx DB value with a sqlx DB value that is currently inside a transaction.

func (*Store) Query

func (s *Store) Query(ctx context.Context, filter home.QueryFilter, orderBy order.By, pageNumber int, rowsPerPage int) ([]home.Home, error)

Query retrieves a list of existing homes from the database.

func (*Store) QueryByID

func (s *Store) QueryByID(ctx context.Context, homeID uuid.UUID) (home.Home, error)

QueryByID gets the specified home from the database.

func (*Store) QueryByUserID

func (s *Store) QueryByUserID(ctx context.Context, userID uuid.UUID) ([]home.Home, error)

QueryByUserID gets the specified home from the database by user id.

func (*Store) Update

func (s *Store) Update(ctx context.Context, hme home.Home) error

Update replaces a home document in the database.

Jump to

Keyboard shortcuts

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