entities

package
v0.0.0-...-caf001f Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Base
	UserName string `json:"user_name" valid:"required"`
	Email    string `json:"email" valid:"required"`
	Password string `json:"password" valid:"required"`
}

func NewAccount

func NewAccount(userName string, email string, password string) (*Account, error)

type Base

type Base struct {
	ID        string    `json:"id" valid:"uuid"`
	CreatedAt time.Time `json:"created_at" valid:"-"`
	UpdatedAt time.Time `json:"updated_at" valid:"-"`
}

type Book

type Book struct {
	Base
	Title       string  `json:"title" valid:"required"`
	Author      string  `json:"author" valid:"required"`
	Price       float64 `json:"price" valid:"required"`
	Description string  `json:"description" valid:"required"`
	UserID      string  `json:"userId" valid:"required"`
}

func NewBook

func NewBook(title string, author string, description string, price float64, UserId string) (*Book, error)

type User

type User struct {
	Base
	Name     string `json:"name" valid:"required"`
	UserName string `json:"user_name" valid:"required"`
	Email    string `json:"email" valid:"email"`
	Books    []Book `json:"books" valid:"-"`
}

func NewUser

func NewUser(name string, userName string, email string) (*User, error)

Jump to

Keyboard shortcuts

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