user

package
v0.0.0-...-2ac5184 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(store Store) *API

func (*API) GetOneHandler

func (api *API) GetOneHandler(w http.ResponseWriter, r *http.Request)

func (*API) InsertHandler

func (api *API) InsertHandler(w http.ResponseWriter, r *http.Request)

func (*API) UpdateHandler

func (api *API) UpdateHandler(w http.ResponseWriter, r *http.Request)

type Page

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

func NewPage

func NewPage() *Page

func (*Page) Form

func (page *Page) Form(w http.ResponseWriter, r *http.Request)

func (*Page) Render

func (page *Page) Render(w http.ResponseWriter, r *http.Request)

type SQLStore

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

func NewSQLStore

func NewSQLStore(db *sqlx.DB) *SQLStore

func (*SQLStore) GetOne

func (s *SQLStore) GetOne(ctx context.Context, id int64) (*User, error)

func (*SQLStore) Insert

func (s *SQLStore) Insert(ctx context.Context, d *User) (int64, error)

func (*SQLStore) Update

func (s *SQLStore) Update(ctx context.Context, id int64, field string, value string) error

type Store

type Store interface {
	Insert(context.Context, *User) (int64, error)
	GetOne(context.Context, int64) (*User, error)
	Update(context.Context, int64, string, string) error
}

type User

type User struct {
	ID        int64     `db:"id"`
	Username  string    `db:"username"`
	Email     string    `db:"email"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

Jump to

Keyboard shortcuts

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