models

package
v0.0.0-...-ee596be Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Email    string `json:"email" validate:"required"`
	Password string `json:"password" validate:"required"`
}

Auth type is a struct for authentication

type AuthClaims

type AuthClaims struct {
	Email string `json:"email"`
	jwt.StandardClaims
}

AuthClaims type is a struct for JWT Claims

type AuthJWT

type AuthJWT struct {
	Token string `json:"token"`
}

AuthJWT type is a struct for JWT authentication

type Conn

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

Conn type is a struct for connections

func Connect

func Connect(db *sql.DB) *Conn

Connect to the database

func (*Conn) Authenticate

func (c *Conn) Authenticate(a *Auth) (bool, error)

func (*Conn) CreateUser

func (c *Conn) CreateUser(u *User) error

CreateUser creates a new user

type User

type User struct {
	ID        int       `json:"id"`
	Email     string    `json:"email" validate:"required,email"`
	Password  string    `json:"password" validate:"required,min=6"`
	FirstName string    `json:"firstname" validate:"required"`
	LastName  string    `json:"lastname"`
	Country   string    `json:"country"`
	Active    bool      `json:"active"`
	CreatedAt time.Time `json:"createdAt"`
}

User type is a struct for users table

Jump to

Keyboard shortcuts

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