auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedDirective

func AuthenticatedDirective(ctx context.Context, next graphql.Resolver) (interface{}, error)

AuthenticatedDirective ...

func CreateUser

func CreateUser(input model.CreateUserInput) (*model.CreateUserPayload, error)

CreateUser ...

func Login

func Login(input model.LoginInput) (*model.LoginPayload, error)

Login ...

func Logout

func Logout(ctx context.Context) (*model.LogoutPayload, error)

Logout ...

Types

type User

type User struct {
	database.BaseModel

	Email    string `json:"email" gorm:"UNIQUE;NOT NULL"`
	Password string `json:"password" gorm:"NOT NULL"`
}

User model

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

BeforeCreate validate the model and then generates an `UUID`, hashes the password and set them.

func (*User) Validate

func (u *User) Validate() error

Validate validates the model.

Jump to

Keyboard shortcuts

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