train

package
v0.0.0-...-f54e1bb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1

README

train

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

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

Index

type TrainService

TrainService manages the different types of trains in the application

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

type TrainServiceImpl

Implementation of TrainService

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

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) Create
func (ts *TrainServiceImpl) Create(ctx context.Context, tt TrainType) (bool, error)

func (*TrainServiceImpl) Delete
func (ts *TrainServiceImpl) Delete(ctx context.Context, id string) (bool, error)

func (*TrainServiceImpl) Retrieve
func (ts *TrainServiceImpl) Retrieve(ctx context.Context, id string) (TrainType, error)

func (*TrainServiceImpl) RetrieveByName
func (ts *TrainServiceImpl) RetrieveByName(ctx context.Context, name string) (TrainType, error)

func (*TrainServiceImpl) RetrieveByNames
func (ts *TrainServiceImpl) RetrieveByNames(ctx context.Context, names []string) ([]TrainType, error)

func (*TrainServiceImpl) Update
func (ts *TrainServiceImpl) Update(ctx context.Context, ttype TrainType) (bool, error)

type TrainType

type TrainType struct {
    ID           string
    Name         string
    EconomyClass int64
    ComfortClass int64
    AvgSpeed     int64
}

Generated by gomarkdoc

Documentation

Overview

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

Index

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

func (ts *TrainServiceImpl) Create(ctx context.Context, tt TrainType) (bool, error)

func (*TrainServiceImpl) Delete

func (ts *TrainServiceImpl) Delete(ctx context.Context, id string) (bool, error)

func (*TrainServiceImpl) Retrieve

func (ts *TrainServiceImpl) Retrieve(ctx context.Context, id string) (TrainType, error)

func (*TrainServiceImpl) RetrieveByName

func (ts *TrainServiceImpl) RetrieveByName(ctx context.Context, name string) (TrainType, error)

func (*TrainServiceImpl) RetrieveByNames

func (ts *TrainServiceImpl) RetrieveByNames(ctx context.Context, names []string) ([]TrainType, error)

func (*TrainServiceImpl) Update

func (ts *TrainServiceImpl) Update(ctx context.Context, ttype TrainType) (bool, error)

type TrainType

type TrainType struct {
	ID           string
	Name         string
	EconomyClass int64
	ComfortClass int64
	AvgSpeed     int64
}

Jump to

Keyboard shortcuts

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