models

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func SetupDatabase

func SetupDatabase()

func SetupTestDatabase

func SetupTestDatabase()

Types

type Time

type Time struct {
	ID        uint          `gorm:"primary_key"`
	Title     string        `gorm:"not null"`
	StartedAt time.Time     `gorm:"not null"`
	StoppedAt time.Time     `gorm:"not null"`
	Duration  time.Duration `gorm:"not null"`
	UserID    uint          `gorm:"index;not null"`
}

type TokenClaims

type TokenClaims struct {
	jwt.StandardClaims
	ID uint `json:"id"`
}

type User

type User struct {
	gorm.Model
	Name         string `gorm:"not null"`
	Email        string `gorm:"unique_index"`
	Password     []byte `gorm:"not null"`
	TimerTitle   *string
	TimerStartAt *time.Time
}

func FindUserByEmail

func FindUserByEmail(email string) (*User, error)

func FindUserByID

func FindUserByID(id uint) (*User, error)

func SetupTestUser

func SetupTestUser() *User

func (*User) Create

func (m *User) Create() error

func (*User) GenerateToken

func (m *User) GenerateToken() (string, error)

func (*User) StartTimer

func (m *User) StartTimer(title string) error

func (*User) StopTimer

func (m *User) StopTimer() (t Time, err error)

func (*User) Times

func (m *User) Times() (times []Time)

func (*User) VerifyPassword

func (m *User) VerifyPassword(password string) error

Jump to

Keyboard shortcuts

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