Documentation
¶
Overview ¶
Package trip The user fly trip reservations
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations ¶
Package trip The user fly trip reservations
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 IServiceBaseRel
- type QRO
- type Service
- type ServiceBase
- func (s *ServiceBase) BelongsToUser(userId string, items int64, page int64) ([]*TripEntity, error)
- func (s *ServiceBase) Create(ctx context.IDataMap, ety *TripEntity) (*TripEntity, error)
- func (s *ServiceBase) Delete(ctx context.IDataMap, id string) error
- func (s *ServiceBase) DeleteByUser(userId string) error
- func (s *ServiceBase) Query(q *tql.Query) (*tql.Result, error)
- func (s *ServiceBase) Read(ctx context.IDataMap, id string) (*TripEntity, error)
- func (s *ServiceBase) Update(ctx context.IDataMap, ety *TripEntity) (*TripEntity, error)
- type TripEntity
- func (e TripEntity) Arrival() string
- func (e TripEntity) Created() int64
- func (e TripEntity) Departure() string
- func (e TripEntity) FieldsMetadata() map[string]*entity.FieldMetadata
- func (e TripEntity) From() int64
- func (e TripEntity) Id() string
- func (e TripEntity) Miles() int64
- func (e TripEntity) SetArrival(arrival string) error
- func (e TripEntity) SetCreated(created int64)
- func (e TripEntity) SetDeparture(departure string) error
- func (e TripEntity) SetFrom(from int64) error
- func (e TripEntity) SetId(id string)
- func (e TripEntity) SetMiles(miles int64) error
- func (e TripEntity) SetTo(to int64) error
- func (e TripEntity) SetUpdated(updated int64)
- func (e TripEntity) SetUserId(userId string) error
- func (e TripEntity) String() string
- func (e TripEntity) TRN() *trn.TRN
- func (e TripEntity) To() int64
- func (e TripEntity) Updated() int64
- func (e TripEntity) UserId() string
Constants ¶
const Name = "trip"
const PluralName = "trips"
Variables ¶
var ( // ErrInvalidField the given field is invalid ErrInvalidField = errors.New("the given field is invalid") )
Functions ¶
func FieldsMetadata ¶
func FieldsMetadata() map[string]*entity.FieldMetadata
FieldsMetadata returns the trip 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"` Departure_ *string `json:"departure,omitempty"` Arrival_ *string `json:"arrival,omitempty"` Miles_ *int64 `json:"miles,omitempty"` From_ *int64 `json:"from,omitempty"` To_ *int64 `json:"to,omitempty"` UserId_ *string `json:"userId,omitempty"` QRO }
func (*EntityQRO) FieldValue ¶
func (*EntityQRO) HydrateFromEntity ¶
func (qro *EntityQRO) HydrateFromEntity(ety *TripEntity, fields ...string) error
type IEntityDMO ¶
type IEntityDMO interface { ToEntity() (*TripEntity, error) HydrateFromEntity(entity *TripEntity) error Id() string Created() int64 Updated() int64 Departure() string Arrival() string Miles() int64 From() int64 To() int64 UserId() string }
IEntityDMO interface to defines the Data Mapper Object implementation
type IEntityDTO ¶
type IEntityDTO interface { Id() string Created() int64 Updated() int64 Departure() string Arrival() string Miles() int64 From() int64 To() int64 UserId() string }
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 *TripEntity) error FetchByID(id string) (*TripEntity, error) Update(entity *TripEntity) error DeleteByID(id string) error Query(q *tql.Query, metadata map[string]string) ([]*TripEntity, error) DeleteByUser(userId string) 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 { IServiceBaseRel Create(ctx context.IDataMap, entity *TripEntity) (*TripEntity, error) Read(ctx context.IDataMap, id string) (*TripEntity, error) Update(ctx context.IDataMap, entity *TripEntity) (*TripEntity, error) Delete(ctx context.IDataMap, id string) error Query(q *tql.Query) (*tql.Result, error) }
IServiceBase interface to defines the service basis implementation
type IServiceBaseRel ¶
type IServiceBaseRel interface { BelongsToUser(userId string, items int64, page int64) ([]*TripEntity, error) DeleteByUser(userId string) error }
IServiceBaseRel interface to defines the relationship methods
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) *Service
NewService Service constructor function
type ServiceBase ¶
type ServiceBase struct {
// contains filtered or unexported fields
}
ServiceBase implements the interface IServiceBase
func (*ServiceBase) BelongsToUser ¶
func (s *ServiceBase) BelongsToUser(userId string, items int64, page int64) ([]*TripEntity, error)
BelongsToUser fetch a list of TripEntity that belongs to User given the userId
func (*ServiceBase) Create ¶
func (s *ServiceBase) Create(ctx context.IDataMap, ety *TripEntity) (*TripEntity, 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) DeleteByUser ¶
func (s *ServiceBase) DeleteByUser(userId string) error
DeleteByUser remove all trip given the userId
func (*ServiceBase) Read ¶
func (s *ServiceBase) Read(ctx context.IDataMap, id string) (*TripEntity, error)
Read returns a pointer to TripEntity given its id
func (*ServiceBase) Update ¶
func (s *ServiceBase) Update(ctx context.IDataMap, ety *TripEntity) (*TripEntity, error)
Update returns a pointer to TripEntity after update it
type TripEntity ¶
type TripEntity struct {
// contains filtered or unexported fields
}
TripEntity The user fly trip reservations
func (TripEntity) Departure ¶
func (e TripEntity) Departure() string
Departure The trip departure airport
func (TripEntity) FieldsMetadata ¶
func (e TripEntity) FieldsMetadata() map[string]*entity.FieldMetadata
func (TripEntity) SetArrival ¶
SetArrival The trip arrival airport
func (TripEntity) SetCreated ¶
func (e TripEntity) SetCreated(created int64)
func (TripEntity) SetDeparture ¶
SetDeparture The trip departure airport
func (TripEntity) SetUpdated ¶
func (e TripEntity) SetUpdated(updated int64)
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 trip.Service for testing purpose
|
Package mocks the service trip.Service for testing purpose |