users

package
v0.0.0-...-c7b10eb Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

A Repository that holds users.

func (Repository) FindUserByUsername

func (r Repository) FindUserByUsername(ctx context.Context, username string) (*User, error)

FindUserByUsername finds a user with the given username. Returns nil if no user is found.

sql:

SELECT * FROM users
  WHERE lower(username) = lower(:username)
  LIMIT 1

type User

type User struct {
	// Username is the user's username.
	Username string `sql:"username"`

	// Email is the user's email address, normalized.
	Email string `sql:"email"`
}

A User in the database.

func (*User) Scan

func (u *User) Scan(rows *sql.Rows) error

Scan scans the columns of the current row of rows into u. Expects rows.Next to be called at least once already.

func (*User) ScanOne

func (u *User) ScanOne(rows *sql.Rows) error

ScanOne scans one row from rows into u.

Jump to

Keyboard shortcuts

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