usersql

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Table is the table we query from to get our user entities.
	Table = "users"

	//TableUserClients is the table for our user, client relationships.
	TableUserClients = "user_clients"
)
View Source
const SelectFrom = `SELECT
	u.id,
	u.email,
	u.created_at,
	u.updated_at,
	u.enabled
	FROM ` + Table + ` AS u`

SelectFrom is our select query without filtering, ordering, etc.

View Source
const SelectFromUserClients = `SELECT user_id, client_id FROM ` + TableUserClients

SelectFromUserClients is our select query for user, client relationships.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

Repo is a user.Repo implementation that uses a SQL database as its storage.

func New

func New(repo *sqlrepo.Repo) *Repo

New returns a new Repo that uses repo to talk to the database.

func (*Repo) Add

func (r *Repo) Add(ctx context.Context, user user.User) error

Add is the user.Repo implementation.

func (*Repo) Get

func (r *Repo) Get(ctx context.Context, id data.Id) (*user.User, error)

Get is the user.QueryRepo implementation.

func (*Repo) GetEmail

func (r *Repo) GetEmail(ctx context.Context, email string) (*user.User, error)

GetEmail is the user.QueryRepo implementation.

func (*Repo) List

func (r *Repo) List(ctx context.Context) ([]*user.User, error)

List is the user.QueryRepo implementation.

func (*Repo) Set

func (r *Repo) Set(ctx context.Context, user user.User) error

Set is the user.Repo implementation.

Jump to

Keyboard shortcuts

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