client

package
v0.0.0-...-2427ed4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DividingLines     = "\n---------------------------------------------------------------------------------------\n"
	LinkUpUserService = "" /* 580-byte string literal not displayed */
)

Variables

View Source
var (
	ErrorColor             = color.New(color.FgHiRed, color.Bold)
	InformationColorYellow = color.New(color.FgHiYellow, color.Bold)
	InformationColorGreen  = color.New(color.FgGreen, color.Bold)
	InformationColorCyan   = color.New(color.FgCyan, color.Bold)
)

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	// Email Address of the user
	Email string `json:"email" validate:"required"`
	// Password of the user
	Password string `json:"password" validate:"required"`
}

AuthData Authorization data of the user

type Config

type Config struct {
	// Host server
	Host string
	// Port server
	Port int
}

Config Connected config

type Person

type Person struct {
	// Identification of the person
	Id *int64 `db:"id" json:"id"`
	// Identification of the user
	UserId *int64 `db:"user_id" json:"userId"`
	// First name
	FirstName *string `db:"first_name" json:"firstName" validate:"required"`
	// Last name
	LastName *string `db:"last_name" json:"lastName" validate:"required"`
	// Middle name
	MiddleName *string `db:"middle_name" json:"middleName,omitempty"`
	// Birth date
	Birthday *time.Time `db:"birthday" json:"birthday,omitempty"`
	// Age
	Age *uint8 `db:"age" json:"age,omitempty"`
	// Gender
	Gender *string `db:"gender" json:"gender,omitempty" validate:"omitempty,oneof=M F"`
	// Phone number
	Phone *string `db:"phone_number" json:"phone,omitempty"`
	// CreatedAt
	CreatedAt *time.Time `db:"created_at" json:"createdAt"`
	// UpdatedAt
	UpdatedAt *time.Time `db:"updated_at" json:"updated,omitempty"`
}

Person entity stores information about a person

func (*Person) Columns

func (m *Person) Columns() []string

func (*Person) SetCreatedAt

func (m *Person) SetCreatedAt()

func (*Person) SetUpdateAt

func (m *Person) SetUpdateAt()

func (*Person) Table

func (m *Person) Table() string

func (*Person) Values

func (m *Person) Values() []interface{}

type PersonSearchForm

type PersonSearchForm struct {
	// Identification of the peron
	Ids []int32 `json:"ids"`
	// Identification of the users
	UserIds []int32 `json:"userIds"`
	// Last name of the person
	LastNames []string `json:"lastNames"`
	// First name of the person
	FirstNames []string `json:"firstNames"`
	// Middle name of the person
	MiddleNames []string `json:"middleNames"`
}

PersonSearchForm search form

func (*PersonSearchForm) PrepareCondition

func (f *PersonSearchForm) PrepareCondition() *gosql.Condition

type Persons

type Persons []*Person

Persons list Person

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service struct

func NewService

func NewService(r *http.Request, cfg Config) *Service

func (*Service) CheckAuthData

func (s *Service) CheckAuthData(email string, password string) (user *User, e lue.IError)

type User

type User struct {
	// Id user identification
	Id *int64 `db:"id" json:"id"`
	// Password
	Password *string `db:"password" json:"password,omitempty"  validate:"omitempty,min=5,max=20" validate:"required_if=Password"`
	// NewPassword New password
	NewPassword *string `json:"newPassword,omitempty" validate:"omitempty,min=5,max=20" validate:"required_if=Password"`
	// Email
	Email *string `db:"email" json:"email" validate:"required,email"`
	// CreatedAt
	CreatedAt *time.Time `db:"created_at" json:"createdAt"`
	// UpdatedAt
	UpdatedAt *time.Time `db:"updated_at" json:"updated,omitempty"`
	// Person stores info about the user
	Person Person `db:"person" json:"person"`
}

User entity for authentication

func NewUser

func NewUser() *User

func (*User) ClearSensitiveData

func (m *User) ClearSensitiveData() *User

func (*User) Columns

func (m *User) Columns() []string

func (*User) SetCreatedAt

func (m *User) SetCreatedAt()

func (*User) SetUpdateAt

func (m *User) SetUpdateAt()

func (*User) Table

func (m *User) Table() string

func (*User) Values

func (m *User) Values() []interface{}

func (*User) ValuesWithPerson

func (m *User) ValuesWithPerson() []interface{}

type UserSearchForm

type UserSearchForm struct {
	// Identification of the users
	Ids []int32 `json:"ids"`
	// Name of the user
	LastNames []string `json:"lastNames"`
	// First name of the user
	FirstNames []string `json:"firstNames"`
	// Middle name of the user
	MiddleNames []string `json:"middleNames"`
}

UserSearchForm user search form

func (*UserSearchForm) PrepareCondition

func (f *UserSearchForm) PrepareCondition() *gosql.Condition

type Users

type Users []*User

Users lists user

Jump to

Keyboard shortcuts

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