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
- Variables
- func FieldsMetadata() map[string]*entity.FieldMetadata
- type EntityDMO
- type EntityQRO
- type IEntityDMO
- type IEntityDTO
- type IRepository
- type IRepositoryBase
- type IService
- type IServiceBase
- type QRO
- type Service
- type ServiceBase
- func (s *ServiceBase) Create(ctx context.IDataMap, ety *UserEntity) (*UserEntity, error)
- func (s *ServiceBase) Delete(ctx context.IDataMap, id string) error
- func (s *ServiceBase) Query(q *tql.Query) (*tql.Result, error)
- func (s *ServiceBase) Read(ctx context.IDataMap, id string) (*UserEntity, error)
- func (s *ServiceBase) Update(ctx context.IDataMap, ety *UserEntity) (*UserEntity, error)
- type UserEntity
- func (e UserEntity) Created() int64
- func (e UserEntity) Email() string
- func (e UserEntity) FieldsMetadata() map[string]*entity.FieldMetadata
- func (e UserEntity) Id() string
- func (e UserEntity) Miles() int64
- func (e UserEntity) Name() string
- func (e UserEntity) Password() string
- func (e UserEntity) Plan() string
- func (e UserEntity) SetCreated(created int64)
- func (e UserEntity) SetEmail(email string) error
- func (e UserEntity) SetId(id string)
- func (e UserEntity) SetMiles(miles int64) error
- func (e UserEntity) SetName(name string) error
- func (e UserEntity) SetPassword(password string) error
- func (e UserEntity) SetPlan(plan string) error
- func (e UserEntity) SetTrips(trips []*trip.TripEntity)
- func (e UserEntity) SetUpdated(updated int64)
- func (e UserEntity) String() string
- func (e UserEntity) TRN() *trn.TRN
- func (e UserEntity) Trips() []*trip.TripEntity
- func (e UserEntity) Updated() int64
Constants ¶
const Name = "user"
const PluralName = "users"
Variables ¶
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 ¶
NewEntityDMO constructor function of EntityDMO
func (*EntityDMO) DecryptString ¶
DecryptString decrypt 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 (*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 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 ¶
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) 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 (UserEntity) FieldsMetadata ¶
func (e UserEntity) FieldsMetadata() map[string]*entity.FieldMetadata
func (UserEntity) Password ¶
func (e UserEntity) Password() string
Password The user system password
func (UserEntity) SetCreated ¶
func (e UserEntity) SetCreated(created int64)
func (UserEntity) SetPassword ¶
SetPassword The user system password
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) Trips ¶
func (e UserEntity) Trips() []*trip.TripEntity
Trips returns a list of trips
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
inputs
|
|
http/gin
Package gin input
|
Package gin input |
outputs
|
|
memory
Package memory is an output adapter to store entities in memory
|
Package memory is an output adapter to store entities in memory |
mongodb
Package mongodb is an output adapter to store entities in MongoDB
|
Package mongodb is an output adapter to store entities in MongoDB |
testing
|
|
mocks
Package mocks the service user.Service for testing purpose
|
Package mocks the service user.Service for testing purpose |