client

package
v0.0.0-...-bcf6333 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	//Id is the Client's id.
	Id data.Id

	//Name is the Client's name.
	//
	//Name must be unique across all Clients in the application.
	Name string

	//CreatedAt is the time at which this Client was created.
	CreatedAt time.Time

	//UpdatedAt is the time at which this Client was most recently updated.
	UpdatedAt time.Time
}

Client is a domain type that represents a client inside the application.

This could be thought of as a business project or business unit. In out line of work, they are called clients.

Different Users are allowed to access different Clients. Furthermore, there would normally be "lower level" domain types that belong to a Client.

type QueryRepo

type QueryRepo interface {
	//Get should return the Client whose Id equals id.
	Get(ctx context.Context, id data.Id) (*Client, error)

	//List should return all Clients in the repository.
	List(ctx context.Context) ([]*Client, error)

	//ListById should return all Clients whose Id is in ids.
	ListByIds(ctx context.Context, ids []data.Id) ([]*Client, error)
}

QueryRepo provides the methods for retrieving Clients.

type Repo

type Repo interface {
	//QueryRepo is promoted to include the retrival methods.
	QueryRepo

	//Add should add c to the underlying repo's storage.
	Add(ctx context.Context, c Client) error

	//Set should udpate all stored fields of c in the underlying storage repository.
	//The update should use c.Id to determine with entity to update.
	Set(ctx context.Context, c Client) error

	//Remove should remove the Client with id from the underlying storage.
	Remove(ctx context.Context, id data.Id) error
}

Repo provides methods for retrieving and manipulating Clients.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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