route

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

README

route

import "github.com/blueprint-uservices/blueprint/examples/train_ticket/workflow/route"

package route implements ts-route-service from the original train ticket application

Index

type Route

type Route struct {
    ID           string
    Stations     []string
    Distances    []int64
    StartStation string
    EndStation   string
}

type RouteInfo

type RouteInfo struct {
    ID           string
    StartStation string
    EndStation   string
    StationList  string
    DistanceList string
}

type RouteService

RouteService manages all the routes in the application

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)
}

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 (r *RouteServiceImpl) CreateAndModify(ctx context.Context, info RouteInfo) (Route, error)

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 (r *RouteServiceImpl) GetRouteById(ctx context.Context, id string) (Route, error)

func (*RouteServiceImpl) GetRouteByIds
func (r *RouteServiceImpl) GetRouteByIds(ctx context.Context, ids []string) ([]Route, error)

func (*RouteServiceImpl) GetRouteByStartAndEnd
func (r *RouteServiceImpl) GetRouteByStartAndEnd(ctx context.Context, start string, end string) (Route, error)

Generated by gomarkdoc

Documentation

Overview

package route implements ts-route-service from the original train ticket application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	ID           string
	Stations     []string
	Distances    []int64
	StartStation string
	EndStation   string
}

type RouteInfo

type RouteInfo struct {
	ID           string
	StartStation string
	EndStation   string
	StationList  string
	DistanceList string
}

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 (r *RouteServiceImpl) CreateAndModify(ctx context.Context, info RouteInfo) (Route, error)

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 (r *RouteServiceImpl) GetRouteById(ctx context.Context, id string) (Route, error)

func (*RouteServiceImpl) GetRouteByIds

func (r *RouteServiceImpl) GetRouteByIds(ctx context.Context, ids []string) ([]Route, error)

func (*RouteServiceImpl) GetRouteByStartAndEnd

func (r *RouteServiceImpl) GetRouteByStartAndEnd(ctx context.Context, start string, end string) (Route, error)

Jump to

Keyboard shortcuts

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