Documentation ¶
Overview ¶
package train implements ts-train-service from the original TrainTicket application
Index ¶
- type TrainService
- type TrainServiceImpl
- func (ts *TrainServiceImpl) AllTrains(ctx context.Context) ([]TrainType, error)
- func (ts *TrainServiceImpl) Create(ctx context.Context, tt TrainType) (bool, error)
- func (ts *TrainServiceImpl) Delete(ctx context.Context, id string) (bool, error)
- func (ts *TrainServiceImpl) Retrieve(ctx context.Context, id string) (TrainType, error)
- func (ts *TrainServiceImpl) RetrieveByName(ctx context.Context, name string) (TrainType, error)
- func (ts *TrainServiceImpl) RetrieveByNames(ctx context.Context, names []string) ([]TrainType, error)
- func (ts *TrainServiceImpl) Update(ctx context.Context, ttype TrainType) (bool, error)
- type TrainType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TrainService ¶
type TrainService interface { // Creates a new type of train Create(ctx context.Context, ttype TrainType) (bool, error) // Retrieves the type of train using its `id` Retrieve(ctx context.Context, id string) (TrainType, error) // Retrieves the type of train using its `name` RetrieveByName(ctx context.Context, name string) (TrainType, error) // Retrieves all train types using its `names` RetrieveByNames(ctx context.Context, names []string) ([]TrainType, error) // Updates an existing train type Update(ctx context.Context, ttype TrainType) (bool, error) // Delete an existing train type Delete(ctx context.Context, id string) (bool, error) // Returns all types of trains AllTrains(ctx context.Context) ([]TrainType, error) }
TrainService manages the different types of trains in the application
type TrainServiceImpl ¶
type TrainServiceImpl struct {
// contains filtered or unexported fields
}
Implementation of TrainService
func NewTrainServiceImpl ¶
func NewTrainServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*TrainServiceImpl, error)
Creates a new TrainService object
func (*TrainServiceImpl) AllTrains ¶
func (ts *TrainServiceImpl) AllTrains(ctx context.Context) ([]TrainType, error)
func (*TrainServiceImpl) RetrieveByName ¶
func (*TrainServiceImpl) RetrieveByNames ¶
Click to show internal directories.
Click to hide internal directories.