station

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: 4 Imported by: 1

README

station

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

package station implements ts-station-service from the original TrainTicket application

Index

type Station

type Station struct {
    ID       string
    Name     string
    StayTime int64
}

type StationService

StationService manages all stations

type StationService interface {
    // Creates a new station
    CreateStation(ctx context.Context, station Station) error
    // Check if a station exists
    Exists(ctx context.Context, name string) (bool, error)
    // Updates an existing station
    UpdateStation(ctx context.Context, station Station) (bool, error)
    // Deletes an existing station based on `id`
    DeleteStation(ctx context.Context, id string) error
    // Find a station based on `id`
    FindByID(ctx context.Context, id string) (Station, error)
    // Find all stations based on `ids`
    FindByIDs(ctx context.Context, ids []string) ([]Station, error)
    // Find the station `id` for the station with Name `name`
    FindID(ctx context.Context, name string) (string, error)
    // Find the station `ids` for stations with Names `names`
    FindIDs(ctx context.Context, names []string) ([]string, error)
}

type StationServiceImpl

Implementation of the StationService

type StationServiceImpl struct {
    // contains filtered or unexported fields
}

func NewStationServiceImpl
func NewStationServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*StationServiceImpl, error)

Returns a new StationService object

func (*StationServiceImpl) CreateStation
func (s *StationServiceImpl) CreateStation(ctx context.Context, station Station) error

func (*StationServiceImpl) DeleteStation
func (s *StationServiceImpl) DeleteStation(ctx context.Context, id string) error

func (*StationServiceImpl) Exists
func (s *StationServiceImpl) Exists(ctx context.Context, name string) (bool, error)

func (*StationServiceImpl) FindByID
func (s *StationServiceImpl) FindByID(ctx context.Context, id string) (Station, error)

func (*StationServiceImpl) FindByIDs
func (s *StationServiceImpl) FindByIDs(ctx context.Context, ids []string) ([]Station, error)

func (*StationServiceImpl) FindID
func (s *StationServiceImpl) FindID(ctx context.Context, name string) (string, error)

func (*StationServiceImpl) FindIDs
func (s *StationServiceImpl) FindIDs(ctx context.Context, names []string) ([]string, error)

func (*StationServiceImpl) UpdateStation
func (s *StationServiceImpl) UpdateStation(ctx context.Context, station Station) (bool, error)

Generated by gomarkdoc

Documentation

Overview

package station implements ts-station-service from the original TrainTicket application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Station

type Station struct {
	ID       string
	Name     string
	StayTime int64
}

type StationService

type StationService interface {
	// Creates a new station
	CreateStation(ctx context.Context, station Station) error
	// Check if a station exists
	Exists(ctx context.Context, name string) (bool, error)
	// Updates an existing station
	UpdateStation(ctx context.Context, station Station) (bool, error)
	// Deletes an existing station based on `id`
	DeleteStation(ctx context.Context, id string) error
	// Find a station based on `id`
	FindByID(ctx context.Context, id string) (Station, error)
	// Find all stations based on `ids`
	FindByIDs(ctx context.Context, ids []string) ([]Station, error)
	// Find the station `id` for the station with Name `name`
	FindID(ctx context.Context, name string) (string, error)
	// Find the station `ids` for stations with Names `names`
	FindIDs(ctx context.Context, names []string) ([]string, error)
}

StationService manages all stations

type StationServiceImpl

type StationServiceImpl struct {
	// contains filtered or unexported fields
}

Implementation of the StationService

func NewStationServiceImpl

func NewStationServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*StationServiceImpl, error)

Returns a new StationService object

func (*StationServiceImpl) CreateStation

func (s *StationServiceImpl) CreateStation(ctx context.Context, station Station) error

func (*StationServiceImpl) DeleteStation

func (s *StationServiceImpl) DeleteStation(ctx context.Context, id string) error

func (*StationServiceImpl) Exists

func (s *StationServiceImpl) Exists(ctx context.Context, name string) (bool, error)

func (*StationServiceImpl) FindByID

func (s *StationServiceImpl) FindByID(ctx context.Context, id string) (Station, error)

func (*StationServiceImpl) FindByIDs

func (s *StationServiceImpl) FindByIDs(ctx context.Context, ids []string) ([]Station, error)

func (*StationServiceImpl) FindID

func (s *StationServiceImpl) FindID(ctx context.Context, name string) (string, error)

func (*StationServiceImpl) FindIDs

func (s *StationServiceImpl) FindIDs(ctx context.Context, names []string) ([]string, error)

func (*StationServiceImpl) UpdateStation

func (s *StationServiceImpl) UpdateStation(ctx context.Context, station Station) (bool, error)

Jump to

Keyboard shortcuts

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