user

package
v0.0.0-...-f52bcce Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Package user The user system

Index

Constants

View Source
const Name = "user"
View Source
const PluralName = "users"

Variables

View Source
var (

	// ErrInvalidField the given field is invalid
	ErrInvalidField = errors.New("the given field is invalid")

	// ErrInvalidPlan the given plan field is invalid
	ErrInvalidPlan = errors.New("the given plan field is invalid")
)

Functions

func FieldsMetadata

func FieldsMetadata() map[string]*entity.FieldMetadata

FieldsMetadata returns the user Entity fields metadata.

Types

type EntityDMO

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

EntityDMO base entity Data Mapper Object

func NewEntityDMO

func NewEntityDMO(key []byte) *EntityDMO

NewEntityDMO constructor function of EntityDMO

func (*EntityDMO) DecryptString

func (dmo *EntityDMO) DecryptString(value string) (string, error)

DecryptString decrypt the given string

func (*EntityDMO) EncryptString

func (dmo *EntityDMO) EncryptString(value string) (string, error)

EncryptString encrypts the given string

type EntityQRO

type EntityQRO struct {
	Id_      *string `json:"id,omitempty"`
	Created_ *int64  `json:"created,omitempty"`
	Updated_ *int64  `json:"updated,omitempty"`

	Name_ *string `json:"name,omitempty"`

	Email_ *string `json:"email,omitempty"`

	Password_ *string `json:"password,omitempty"`

	Plan_ *string `json:"plan,omitempty"`

	Miles_ *int64 `json:"miles,omitempty"`

	QRO
}

func (*EntityQRO) FieldValue

func (qro *EntityQRO) FieldValue(field string) interface{}

func (*EntityQRO) HydrateFromEntity

func (qro *EntityQRO) HydrateFromEntity(ety *UserEntity, fields ...string) error

type IEntityDMO

type IEntityDMO interface {
	ToEntity() (*UserEntity, error)
	HydrateFromEntity(entity *UserEntity) error
	Id() string
	Created() int64
	Updated() int64
	Name() string
	Email() string
	Password() (string, error)
	Plan() string
	Miles() int64
}

IEntityDMO interface to defines the Data Mapper Object implementation

type IEntityDTO

type IEntityDTO interface {
	Id() string
	Created() int64
	Updated() int64

	Name() string
	Email() string
	Password() string
	Plan() string
	Miles() int64
}

IEntityDTO interface to defines the Data Transfer Object implementation

type IRepository

type IRepository interface {
	IRepositoryBase // DO NOT REMOVE this line. IRepositoryBase defines all CRUD operations for the entity and the TQL

}

type IRepositoryBase

type IRepositoryBase interface {
	Save(entity *UserEntity) error
	FetchByID(id string) (*UserEntity, error)
	Update(entity *UserEntity) error
	DeleteByID(id string) error

	Query(q *tql.Query, metadata map[string]string) ([]*UserEntity, error)
}

IRepositoryBase interface to defines the base repository implementation

type IService

type IService interface {
	IServiceBase // DO NOT REMOVE this line. IServiceBase defines all CRUD operations for the entity

}

IService interface that aggregates IServiceBase. All of your use cases should be added here.

type IServiceBase

type IServiceBase interface {
	Create(ctx context.IDataMap, entity *UserEntity) (*UserEntity, error)
	Read(ctx context.IDataMap, id string) (*UserEntity, error)
	Update(ctx context.IDataMap, entity *UserEntity) (*UserEntity, error)
	Delete(ctx context.IDataMap, id string) error
	Query(q *tql.Query) (*tql.Result, error)
}

IServiceBase interface to defines the service basis implementation

type QRO

type QRO struct {
}

type Service

type Service struct {
	*ServiceBase // DO NOT REMOVE this line. ServiceBase implements IServiceBase interface
}

Service defines your use cases. Extends from ServiceBase to get the CRUD operations

func NewService

func NewService(repo IRepository, logger log.ILogger, tripSrv trip.IService) *Service

NewService Service constructor function

type ServiceBase

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

ServiceBase implements the interface IServiceBase

func (*ServiceBase) Create

func (s *ServiceBase) Create(ctx context.IDataMap, ety *UserEntity) (*UserEntity, error)

Create given a new entity this one is populated with ID and creation timestamp and finally saved into the repository

func (*ServiceBase) Delete

func (s *ServiceBase) Delete(ctx context.IDataMap, id string) error

Delete removes the entity given its id

func (*ServiceBase) Query

func (s *ServiceBase) Query(q *tql.Query) (*tql.Result, error)

Query executes the given query (TQL) and returns the query result

func (*ServiceBase) Read

func (s *ServiceBase) Read(ctx context.IDataMap, id string) (*UserEntity, error)

Read returns a pointer to UserEntity given its id

func (*ServiceBase) Update

func (s *ServiceBase) Update(ctx context.IDataMap, ety *UserEntity) (*UserEntity, error)

Update returns a pointer to UserEntity after update it

type UserEntity

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

UserEntity The user system

func New

func New() *UserEntity

New is a UserEntity constructor function

func (UserEntity) Created

func (e UserEntity) Created() int64

func (UserEntity) Email

func (e UserEntity) Email() string

Email The user contact email

func (UserEntity) FieldsMetadata

func (e UserEntity) FieldsMetadata() map[string]*entity.FieldMetadata

func (UserEntity) Id

func (e UserEntity) Id() string

func (UserEntity) Miles

func (e UserEntity) Miles() int64

Miles The accumulated flyer miles

func (UserEntity) Name

func (e UserEntity) Name() string

Name The user full name

func (UserEntity) Password

func (e UserEntity) Password() string

Password The user system password

func (UserEntity) Plan

func (e UserEntity) Plan() string

Plan The user membership plan

func (UserEntity) SetCreated

func (e UserEntity) SetCreated(created int64)

func (UserEntity) SetEmail

func (e UserEntity) SetEmail(email string) error

SetEmail The user contact email

func (UserEntity) SetId

func (e UserEntity) SetId(id string)

func (UserEntity) SetMiles

func (e UserEntity) SetMiles(miles int64) error

SetMiles The accumulated flyer miles

func (UserEntity) SetName

func (e UserEntity) SetName(name string) error

SetName The user full name

func (UserEntity) SetPassword

func (e UserEntity) SetPassword(password string) error

SetPassword The user system password

func (UserEntity) SetPlan

func (e UserEntity) SetPlan(plan string) error

SetPlan The user membership plan

func (UserEntity) SetTrips

func (e UserEntity) SetTrips(trips []*trip.TripEntity)

SetTrips sets a list of trips

func (UserEntity) SetUpdated

func (e UserEntity) SetUpdated(updated int64)

func (UserEntity) String

func (e UserEntity) String() string

String returns the string representation of the entityBase

func (UserEntity) TRN

func (e UserEntity) TRN() *trn.TRN

func (UserEntity) Trips

func (e UserEntity) Trips() []*trip.TripEntity

Trips returns a list of trips

func (UserEntity) Updated

func (e UserEntity) Updated() int64

Directories

Path Synopsis
inputs
outputs
testing

Jump to

Keyboard shortcuts

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