entity

package
v0.0.0-...-3d4da3c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 4 Imported by: 0

README

  • Entity is your main business model
  • Here you define your main object models or properties for your business
  • Keep this package simple, don't code anything that is not related to the model itself

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveStatus

type ActiveStatus uint8

func (*ActiveStatus) IsActive

func (a *ActiveStatus) IsActive() bool

func (*ActiveStatus) Primitive

func (a *ActiveStatus) Primitive() uint8

func (*ActiveStatus) Set

func (a *ActiveStatus) Set(val uint8)

type Email

type Email string

func (*Email) Primitive

func (e *Email) Primitive() string

func (*Email) Set

func (e *Email) Set(val string)

func (*Email) Validate

func (e *Email) Validate() error

type FirstName

type FirstName string

func (*FirstName) IsEmpty

func (f *FirstName) IsEmpty() bool

func (*FirstName) Primitive

func (f *FirstName) Primitive() string

func (*FirstName) Set

func (f *FirstName) Set(val string)

func (*FirstName) Validate

func (f *FirstName) Validate() error

type Gender

type Gender uint8

func (*Gender) IsEmpty

func (g *Gender) IsEmpty() bool

func (*Gender) IsFemale

func (g *Gender) IsFemale() bool

func (*Gender) IsMale

func (g *Gender) IsMale() bool

func (*Gender) IsValid

func (g *Gender) IsValid() bool

func (*Gender) Primitive

func (g *Gender) Primitive() uint8

func (*Gender) Set

func (g *Gender) Set(val uint8)

type ID

type ID uint32

func (*ID) IsValid

func (i *ID) IsValid() bool

func (*ID) Primitive

func (i *ID) Primitive() uint32

func (*ID) Set

func (i *ID) Set(val uint32)

type Image

type Image string

func (*Image) GetPostgreSQLType

func (i *Image) GetPostgreSQLType() pgtype.Varchar

func (*Image) Primitive

func (i *Image) Primitive() string

func (*Image) PrimitiveFromPostgreSQLType

func (i *Image) PrimitiveFromPostgreSQLType(tp pgtype.Varchar) string

func (*Image) Set

func (i *Image) Set(val string)

type LastName

type LastName string

func (*LastName) IsEmpty

func (l *LastName) IsEmpty() bool

func (*LastName) Primitive

func (l *LastName) Primitive() string

func (*LastName) Set

func (l *LastName) Set(val string)

func (*LastName) Validate

func (l *LastName) Validate() error

type Password

type Password string

func (*Password) Primitive

func (p *Password) Primitive() string

func (*Password) Set

func (p *Password) Set(val string)

func (*Password) Validate

func (p *Password) Validate() error

type Profile

type Profile struct {
	ID        ID        `json:"id"`
	UserID    ID        `json:"user_id"`
	FirstName FirstName `json:"first_name"`
	LastName  LastName  `json:"last_name"`
	Image     Image     `json:"image"`
	Gender    Gender    `json:"gender"`
	CreatedAt Time      `json:"created_at"`
	UpdatedAt Time      `json:"updated_at"`
}

type ProfileForClient

type ProfileForClient Profile

type Profiles

type Profiles []*Profile

type ProfilesForClient

type ProfilesForClient []*ProfileForClient

type StdError

type StdError interface {
	GetError() error
	GetCode() string
	GetMessage() string
	GetStatus() int
}

func NewStdError

func NewStdError(code, message string, status int) StdError

NewStdError generates new StdError.

type Time

type Time string

func (*Time) GetPostgreSQLType

func (t *Time) GetPostgreSQLType() pgtype.Timestamp

func (*Time) IsZero

func (t *Time) IsZero() bool

func (*Time) Primitive

func (t *Time) Primitive() string

func (*Time) PrimitiveFromPostgreSQLType

func (t *Time) PrimitiveFromPostgreSQLType(tp pgtype.Timestamp) time.Time

func (*Time) Set

func (t *Time) Set(val string)

func (*Time) SetFromTime

func (t *Time) SetFromTime(tm time.Time, tz Timezone)

func (*Time) ToTime

func (t *Time) ToTime() (time.Time, error)

type Timezone

type Timezone struct {
	Name   string
	Offset int
}

type User

type User struct {
	ID           ID           `json:"id"`
	Username     Username     `json:"username"`
	Email        Email        `json:"email"`
	Password     Password     `json:"password"`
	ActiveStatus ActiveStatus `json:"active_status"`
	CreatedAt    Time         `json:"created_at"`
	UpdatedAt    Time         `json:"updated_at"`
	DeletedAt    Time         `json:"deleted_at"`
}

type UserForClient

type UserForClient struct {
	ID           ID           `json:"id"`
	Username     Username     `json:"username"`
	Email        Email        `json:"email"`
	ActiveStatus ActiveStatus `json:"active_status"`
	CreatedAt    Time         `json:"created_at"`
	UpdatedAt    Time         `json:"updated_at"`
}

type UserWithProfile

type UserWithProfile struct {
	User
	Profile *Profile `json:"profile"`
}

type UserWithProfileForClient

type UserWithProfileForClient struct {
	UserForClient
	Profile *ProfileForClient `json:"profile"`
}

type Username

type Username string

func (*Username) Primitive

func (u *Username) Primitive() string

func (*Username) Set

func (u *Username) Set(val string)

func (*Username) Validate

func (u *Username) Validate() error

type UsernameOrEmail

type UsernameOrEmail string

func (*UsernameOrEmail) Primitive

func (u *UsernameOrEmail) Primitive() string

func (*UsernameOrEmail) Set

func (u *UsernameOrEmail) Set(val string)

func (*UsernameOrEmail) Validate

func (u *UsernameOrEmail) Validate() error

type Users

type Users []*User

type UsersForClient

type UsersForClient []*UserForClient

type UsersWithProfile

type UsersWithProfile []*UserWithProfile

type UsersWithProfileForClient

type UsersWithProfileForClient []*UserWithProfileForClient

Jump to

Keyboard shortcuts

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