Documentation ¶
Overview ¶
Package postgres provides an API to an Postgres3 database that conforms to domain outbound interfaces.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateUser(ctx context.Context, req *user.RegistrationRequest) (*user.User, error)
- func (c *Client) GetUserByEmail(ctx context.Context, email user.EmailAddress) (*user.User, error)
- func (c *Client) GetUserByID(ctx context.Context, id uuid.UUID) (*user.User, error)
- func (c *Client) UpdateUser(ctx context.Context, req *user.UpdateRequest) (*user.User, error)
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Postgres client.
func New ¶
New returns a Client instance connected to the server at `url`, running any migrations that have not yet been applied.
func (*Client) CreateUser ¶
CreateUser creates a new user record from the given user.RegistrationRequest and returns the created user.User.
Returns user.ValidationError if database constraints are violated.
func (*Client) GetUserByEmail ¶
GetUserByEmail returns the user.User with the given email, or user.NotFoundError if no user exists with that email.
func (*Client) GetUserByID ¶
GetUserByID returns the user.User with the given ID, or user.NotFoundError if no such user exists.
func (*Client) UpdateUser ¶
UpdateUser updates the user record specified by `req` and returns the updated user.User.
Returns user.ValidationError if database constraints are violated.