Documentation ¶
Overview ¶
package route implements ts-route-service from the original train ticket application
Index ¶
- type Route
- type RouteInfo
- type RouteService
- type RouteServiceImpl
- func (r *RouteServiceImpl) CreateAndModify(ctx context.Context, info RouteInfo) (Route, error)
- func (r *RouteServiceImpl) DeleteRoute(ctx context.Context, id string) error
- func (r *RouteServiceImpl) GetAllRoutes(ctx context.Context) ([]Route, error)
- func (r *RouteServiceImpl) GetRouteById(ctx context.Context, id string) (Route, error)
- func (r *RouteServiceImpl) GetRouteByIds(ctx context.Context, ids []string) ([]Route, error)
- func (r *RouteServiceImpl) GetRouteByStartAndEnd(ctx context.Context, start string, end string) (Route, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RouteService ¶
type RouteService interface { // Get a route based on the `start` point and `end` point GetRouteByStartAndEnd(ctx context.Context, start string, end string) (Route, error) // Gets all routes GetAllRoutes(ctx context.Context) ([]Route, error) // Get a route by ID GetRouteById(ctx context.Context, id string) (Route, error) // Get multiple routes based on ids GetRouteByIds(ctx context.Context, ids []string) ([]Route, error) // Delete a route by `id` DeleteRoute(ctx context.Context, id string) error // Create a new route or modify an existing route based on provided `info` for the route CreateAndModify(ctx context.Context, info RouteInfo) (Route, error) }
RouteService manages all the routes in the application
type RouteServiceImpl ¶
type RouteServiceImpl struct {
// contains filtered or unexported fields
}
func NewRouteServiceImpl ¶
func NewRouteServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*RouteServiceImpl, error)
func (*RouteServiceImpl) CreateAndModify ¶
func (*RouteServiceImpl) DeleteRoute ¶
func (r *RouteServiceImpl) DeleteRoute(ctx context.Context, id string) error
func (*RouteServiceImpl) GetAllRoutes ¶
func (r *RouteServiceImpl) GetAllRoutes(ctx context.Context) ([]Route, error)
func (*RouteServiceImpl) GetRouteById ¶
func (*RouteServiceImpl) GetRouteByIds ¶
func (*RouteServiceImpl) GetRouteByStartAndEnd ¶
Click to show internal directories.
Click to hide internal directories.