users

package
v0.0.0-...-c99c9b3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

BaseModel is used when creating and deleting a user database will soft delete a user

type PrivateUser

type PrivateUser struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	Status    bool   `json:"status"`
}

type PublicUser

type PublicUser struct {
	ID       string `json:"id"`
	Username string `json:"username"`
}

type User

type User struct {
	BaseModel
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Username   string `json:"username"`
	Email      string `json:"email"`
	Password   string `json:"password"`
	ResetToken string `json:"reset_token"`
	Active     bool   `json:"active"`
}

User is our microservice definition of a user

func (*User) Create

func (user *User) Create() error

func (*User) Delete

func (user *User) Delete() error

func (*User) EmailUsed

func (u *User) EmailUsed() bool

func (*User) Marshal

func (user *User) Marshal(isPublic bool) interface{}

Marshal a public or private user

func (*User) Read

func (user *User) Read() (*User, error)

func (*User) Update

func (user *User) Update()

func (*User) UsernameUsed

func (u *User) UsernameUsed() bool

func (*User) Validate

func (user *User) Validate() error

TODO: Validate User

type Users

type Users []User

func (Users) Marshal

func (users Users) Marshal(isPublic bool) []interface{}

Marshal many users

Jump to

Keyboard shortcuts

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