mysql

package
v0.0.0-...-a0af51b Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SnippetModel

type SnippetModel struct {
	DB *sql.DB
}

SnippetModel wraps a DB connection pool for Snippets

func (*SnippetModel) Get

func (m *SnippetModel) Get(id int) (*models.Snippet, error)

Get returns a snippet if found

func (*SnippetModel) Insert

func (m *SnippetModel) Insert(title, content, expires string) (int, error)

Insert makes a new Snippet addition in the DB

func (*SnippetModel) Latest

func (m *SnippetModel) Latest() ([]*models.Snippet, error)

Latest will return the 10 most recent snippets

type UserModel

type UserModel struct {
	DB *sql.DB
}

UserModel struct

func (*UserModel) Authenticate

func (m *UserModel) Authenticate(email, password string) (int, error)

Authenticate a user

func (*UserModel) Get

func (m *UserModel) Get(id int) (*models.User, error)

Get a user given an ID

func (*UserModel) Insert

func (m *UserModel) Insert(name, email, password string) error

Insert a newuser

Jump to

Keyboard shortcuts

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