model

package
v0.0.0-...-b8661fc Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

HashPassword returns the bcrypt hash of the password

Types

type Claims

type Claims struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email"`
	IsAdmin  bool   `json:"isAdmin"`
	jwt.StandardClaims
}

type Credentials

type Credentials struct {
	Username string `json:"username" datastore:"username"`
	Password string `json:"password,omitempty" datastore:"password,noindex"`
}

type Token

type Token struct {
	TokenString string
	Expiration  time.Time
}

type User

type User struct {
	Key            *datastore.Key `json:"-" datastore:"__key__"`
	ID             string         `json:"id" datastore:"-"`
	Created        time.Time      `json:"dateCreated,omitempty" datastore:"dateCreated,noindex"`
	Updated        time.Time      `json:"lastUpdated,omitempty" datastore:"lastUpdated,noindex"`
	Creator        string         `json:"creator,omitempty" datastore:"creator,noindex"`
	Modifier       string         `json:"modifier,omitempty" datastore:"modifier,noindex"`
	IsAdmin        bool           `json:"isAdmin" datastore:"isAdmin"`
	Email          string         `json:"email" datastore:"email"`
	HashedPassword string         `json:"-" datastore:"hashedPassword,noindex"`
	Token          Token          `json:"-" datastore:"-"`
	TokenString    string         `json:"token" datastore:"-"`
	Credentials
}

func (*User) Enrich

func (s *User) Enrich()

Enrich song with some basic data if needed

type Validation

type Validation struct {
	TokenValid bool `json:"valid"`
}

Jump to

Keyboard shortcuts

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