models

package
v0.0.0-...-29554df Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(p string) string

HashPassword Return string password as a hash

func ListToProto

func ListToProto(list List) *listProto.List

ListToProto Convert a single List to proto

func ListsToProto

func ListsToProto(lists []List) []*listProto.List

ListsToProto Convert Lists to proto

func TaskToProto

func TaskToProto(task Task) *taskProto.Task

TaskToProto Convert a Task to proto task

func TasksToProto

func TasksToProto(tasks []Task) []*taskProto.Task

TasksToProto Convert Tasks to proto

func UserToProto

func UserToProto(user User) *userProto.User

UserToProto Convert a single User to proto

func ValidateEmail

func ValidateEmail(e string) error

ValidateEmail Email must be valid

func ValidatePassword

func ValidatePassword(p string) error

ValidatePassword Passwords must longer then 5 charactors

Types

type List

type List struct {
	gorm.Model
	Name   string `gorm:"not null"`
	UserID uint
	Tasks  []Task `gorm:"foreignkey:ListID"`
	Index  uint
}

List A container of tasks

func ProtoToList

func ProtoToList(list *listProto.List) List

ProtoToList Convert proto to Task

type Task

type Task struct {
	gorm.Model
	Heading  string `gorm:"not null"`
	ListID   uint
	Status   uint
	Deadline time.Time
}

Task A single unit

func ProtoToTask

func ProtoToTask(task *taskProto.Task) Task

ProtoToTask Convert proto to Task

func ProtosToTask

func ProtosToTask(tasks []*taskProto.Task) []Task

ProtosToTask Convert protos to Tasks

type User

type User struct {
	gorm.Model
	Email        string `gorm:"type:varchar(100);unique_index"`
	PasswordHash string `gorm:"not null"`
	Token        string `gorm:"-"`
}

User An actor in our system

Jump to

Keyboard shortcuts

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