Documentation ¶
Index ¶
- Constants
- Variables
- type Business
- func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, error)
- func (b *Business) Create(ctx context.Context, nu NewGalaxy) (Galaxy, error)
- func (b *Business) Delete(ctx context.Context, gal Galaxy) error
- func (b *Business) Query(ctx context.Context, filter QueryFilter, orderBy order.By, pageNumber int, ...) ([]Galaxy, error)
- func (b *Business) QueryByID(ctx context.Context, galaxyID uuid.UUID) (Galaxy, error)
- func (b *Business) QueryByName(ctx context.Context, galaxyName string) (Galaxy, error)
- func (b *Business) Update(ctx context.Context, gal Galaxy, uu UpdateGalaxy) (Galaxy, error)
- type Galaxy
- type Name
- type NewGalaxy
- type QueryFilter
- type Storer
- type UpdateGalaxy
Constants ¶
const ( OrderByID = "galaxy_id" OrderByName = "name" OrderByEnabled = "enabled" )
Set of fields that the results can be ordered by.
Variables ¶
var ( ErrNotFound = errors.New("galaxy not found") ErrUniqueEmail = errors.New("email is not unique") ErrAuthenticationFailure = errors.New("authentication failed") )
Set of error variables for CRUD operations.
DefaultOrderBy represents the default way we sort.
var Names nameSet
Functions ¶
This section is empty.
Types ¶
type Business ¶
type Business struct {
// contains filtered or unexported fields
}
Business manages the set of APIs for galaxy access.
func NewBusiness ¶
NewBusiness constructs a galaxy business API for use.
func (*Business) Query ¶
func (b *Business) Query(ctx context.Context, filter QueryFilter, orderBy order.By, pageNumber int, rowsPerPage int) ([]Galaxy, error)
Query retrieves a list of existing galaxies.
func (*Business) QueryByName ¶
QueryByName finds the galaxy by the specified Ib.
type Galaxy ¶
type Galaxy struct { ID uuid.UUID Name Name OwnerUserID uuid.UUID Enabled bool DateCreated time.Time DateUpdated time.Time }
Galaxy represents information about an individual galaxy.
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
Name represents a name in the system.
func (Name) MarshalText ¶
MarshalText implement the marshal interface for JSON conversions.
func (*Name) UnmarshalText ¶
UnmarshalText implement the unmarshal interface for JSON conversions.
type NewGalaxy ¶
NewGalaxy contains information needed to create a new galaxy.
func TestNewGalaxies ¶
TestNewGalaxies is a helper method for testing.
type QueryFilter ¶
QueryFilter holds the available fields a query can be filtered on. We are using pointer semantics because the With API mutates the value.
type Storer ¶
type Storer interface { Create(ctx context.Context, gal Galaxy) error Update(ctx context.Context, gal Galaxy) error Delete(ctx context.Context, gal Galaxy) error Query(ctx context.Context, filter QueryFilter, orderBy order.By, pageNumber int, rowsPerPage int) ([]Galaxy, error) Count(ctx context.Context, filter QueryFilter) (int, error) QueryByID(ctx context.Context, galaxyID uuid.UUID) (Galaxy, error) QueryByName(ctx context.Context, galaxyName string) (Galaxy, error) }
Storer interface declares the behavior this package needs to perists and retrieve data.