mysql

package
v0.0.0-...-ab70a69 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 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 SnippetModel

type SnippetModel struct {
	DB *sql.DB
}

SnippetModel Defines a type which wraps a sql.DB connection pool

func (*SnippetModel) Get

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

Get will return a specific snippet based on Id.

func (*SnippetModel) Insert

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

Insert will insert a new snippet into the database.

func (*SnippetModel) Latest

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

Latest will return the 10 most recently created snippets.

type UserModel

type UserModel struct {
	DB *sql.DB
}

UserModel models

func (*UserModel) Authenticate

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

Authenticate user authenticate

func (*UserModel) Get

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

Get get

func (*UserModel) Insert

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

Insert insert

Jump to

Keyboard shortcuts

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