assurance

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

README

assurance

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

Package assurance implements the ts-assurance service from the original TrainTicket application

Index

Variables

var ALL_ASSURANCES = []AssuranceType{TRAFFIC_ACCIDENT}

var TRAFFIC_ACCIDENT = AssuranceType{1, "Traffic Accident Assurance", 3.0}

type Assurance

type Assurance struct {
    ID      string
    OrderID string
    AT      AssuranceType
}

type AssuranceService

AssuranceService manages assurances provided to customers for trips

type AssuranceService interface {
    // Find an assurance by ID of the assurance
    FindAssuranceById(ctx context.Context, id string) (Assurance, error)
    // Find an assurance by Order ID
    FindAssuranceByOrderId(ctx context.Context, orderId string) (Assurance, error)
    // Creates a new Assurance
    Create(ctx context.Context, typeindex int64, orderId string) (Assurance, error)
    // Deletes the assurance with ID `id`
    DeleteById(ctx context.Context, id string) error
    // Delete the assurance associated with order that has id `orderId`
    DeleteByOrderId(ctx context.Context, orderId string) error
    // Modify an existing an assurance with provided Assurance `a`
    Modify(ctx context.Context, a Assurance) (Assurance, error)
    // Return all assurances
    GetAllAssurances(ctx context.Context) ([]Assurance, error)
    // Return all types of assurances
    GetAllAssuranceTypes(ctx context.Context) ([]AssuranceType, error)
}

type AssuranceServiceImpl

Implementation of an AssuranceService

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

func NewAssuranceServiceImpl
func NewAssuranceServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*AssuranceServiceImpl, error)

Constructs an AssuranceService object

func (*AssuranceServiceImpl) Create
func (a *AssuranceServiceImpl) Create(ctx context.Context, typeindex int64, orderid string) (Assurance, error)

func (*AssuranceServiceImpl) DeleteById
func (a *AssuranceServiceImpl) DeleteById(ctx context.Context, id string) error

func (*AssuranceServiceImpl) DeleteByOrderId
func (a *AssuranceServiceImpl) DeleteByOrderId(ctx context.Context, order_id string) error

func (*AssuranceServiceImpl) FindAssuranceById
func (a *AssuranceServiceImpl) FindAssuranceById(ctx context.Context, id string) (Assurance, error)

func (*AssuranceServiceImpl) FindAssuranceByOrderId
func (a *AssuranceServiceImpl) FindAssuranceByOrderId(ctx context.Context, order_id string) (Assurance, error)

func (*AssuranceServiceImpl) GetAllAssuranceTypes
func (a *AssuranceServiceImpl) GetAllAssuranceTypes(ctx context.Context) ([]AssuranceType, error)

func (*AssuranceServiceImpl) GetAllAssurances
func (a *AssuranceServiceImpl) GetAllAssurances(ctx context.Context) ([]Assurance, error)

func (*AssuranceServiceImpl) Modify
func (a *AssuranceServiceImpl) Modify(ctx context.Context, assurance Assurance) (Assurance, error)

type AssuranceType

type AssuranceType struct {
    Index int64
    Name  string
    Price float64
}

Generated by gomarkdoc

Documentation

Overview

Package assurance implements the ts-assurance service from the original TrainTicket application

Index

Constants

This section is empty.

Variables

View Source
var ALL_ASSURANCES = []AssuranceType{TRAFFIC_ACCIDENT}
View Source
var TRAFFIC_ACCIDENT = AssuranceType{1, "Traffic Accident Assurance", 3.0}

Functions

This section is empty.

Types

type Assurance

type Assurance struct {
	ID      string
	OrderID string
	AT      AssuranceType
}

type AssuranceService

type AssuranceService interface {
	// Find an assurance by ID of the assurance
	FindAssuranceById(ctx context.Context, id string) (Assurance, error)
	// Find an assurance by Order ID
	FindAssuranceByOrderId(ctx context.Context, orderId string) (Assurance, error)
	// Creates a new Assurance
	Create(ctx context.Context, typeindex int64, orderId string) (Assurance, error)
	// Deletes the assurance with ID `id`
	DeleteById(ctx context.Context, id string) error
	// Delete the assurance associated with order that has id `orderId`
	DeleteByOrderId(ctx context.Context, orderId string) error
	// Modify an existing an assurance with provided Assurance `a`
	Modify(ctx context.Context, a Assurance) (Assurance, error)
	// Return all assurances
	GetAllAssurances(ctx context.Context) ([]Assurance, error)
	// Return all types of assurances
	GetAllAssuranceTypes(ctx context.Context) ([]AssuranceType, error)
}

AssuranceService manages assurances provided to customers for trips

type AssuranceServiceImpl

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

Implementation of an AssuranceService

func NewAssuranceServiceImpl

func NewAssuranceServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*AssuranceServiceImpl, error)

Constructs an AssuranceService object

func (*AssuranceServiceImpl) Create

func (a *AssuranceServiceImpl) Create(ctx context.Context, typeindex int64, orderid string) (Assurance, error)

func (*AssuranceServiceImpl) DeleteById

func (a *AssuranceServiceImpl) DeleteById(ctx context.Context, id string) error

func (*AssuranceServiceImpl) DeleteByOrderId

func (a *AssuranceServiceImpl) DeleteByOrderId(ctx context.Context, order_id string) error

func (*AssuranceServiceImpl) FindAssuranceById

func (a *AssuranceServiceImpl) FindAssuranceById(ctx context.Context, id string) (Assurance, error)

func (*AssuranceServiceImpl) FindAssuranceByOrderId

func (a *AssuranceServiceImpl) FindAssuranceByOrderId(ctx context.Context, order_id string) (Assurance, error)

func (*AssuranceServiceImpl) GetAllAssuranceTypes

func (a *AssuranceServiceImpl) GetAllAssuranceTypes(ctx context.Context) ([]AssuranceType, error)

func (*AssuranceServiceImpl) GetAllAssurances

func (a *AssuranceServiceImpl) GetAllAssurances(ctx context.Context) ([]Assurance, error)

func (*AssuranceServiceImpl) Modify

func (a *AssuranceServiceImpl) Modify(ctx context.Context, assurance Assurance) (Assurance, error)

type AssuranceType

type AssuranceType struct {
	Index int64
	Name  string
	Price float64
}

Jump to

Keyboard shortcuts

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