model

package
v0.0.0-...-fce603d Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(ctx context.Context, db *sql.DB, ID uuid.UUID) error

Types

type UserModel

type UserModel struct {
	ID        uuid.UUID
	Name      string
	Email     string
	Password  string
	CreatedAt time.Time
	CreatedBy uuid.UUID
	UpdatedAt pq.NullTime
	UpdatedBy uuid.NullUUID
}

func GetAllUser

func GetAllUser(ctx context.Context, db *sql.DB) ([]UserModel, error)

func GetOneUser

func GetOneUser(ctx context.Context, db *sql.DB, ID uuid.UUID) (UserModel, error)

func GetOneUserByEmail

func GetOneUserByEmail(ctx context.Context, db *sql.DB, email string) (UserModel, error)

func (UserModel) Insert

func (usr UserModel) Insert(ctx context.Context, db *sql.DB) (UserModel, error)

func (*UserModel) Response

func (user *UserModel) Response() UserModelResponse

Convert user model into json-friendly formatted response struct (without null data type).

func (UserModel) Update

func (usr UserModel) Update(ctx context.Context, db *sql.DB) error

type UserModelResponse

type UserModelResponse struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	Password  string    `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	CreatedBy uuid.UUID `json:"created_by"`
	UpdatedAt time.Time `json:"updated_at"`
	UpdatedBy uuid.UUID `json:"updated_by"`
}

func (UserModelResponse) Identifier

func (am UserModelResponse) Identifier() uuid.UUID

Jump to

Keyboard shortcuts

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