Documentation
¶
Overview ¶
Package service provides helper utilities for the stock gRPC service implementation.
Index ¶
- type ContextualConverter
- type ContextualErrorHandler
- type MockPublisher
- type PlasmidCollectionConverter
- type PlasmidCollectionEither
- type PlasmidCollectionIO
- type PlasmidCollectionResult
- type PlasmidConverter
- type PlasmidEither
- type PlasmidIO
- type PlasmidIOExecutor
- type PlasmidPublisher
- type PlasmidResult
- type PlasmidResultFolder
- type StockRepository
- type StockService
- func (s *StockService) AutocompleteStock(ctx context.Context, r *stock.StockAutocompleteParameters) (*stock.StockSuggestionCollection, error)
- func (s *StockService) CountStocks(ctx context.Context, _ *empty.Empty) (*stock.StockCounts, error)
- func (s *StockService) CreatePlasmid(ctx context.Context, req *stock.NewPlasmid) (*stock.Plasmid, error)
- func (s *StockService) CreateStrain(ctx context.Context, r *stock.NewStrain) (*stock.Strain, error)
- func (s *StockService) GetPlasmid(ctx context.Context, req *stock.StockId) (*stock.Plasmid, error)
- func (s *StockService) GetStrain(ctx context.Context, r *stock.StockId) (*stock.Strain, error)
- func (s *StockService) ListPlasmids(ctx context.Context, param *stock.StockParameters) (*stock.PlasmidCollection, error)
- func (s *StockService) ListStrains(ctx context.Context, param *stock.StockParameters) (*stock.StrainCollection, error)
- func (s *StockService) ListStrainsByIDs(ctx context.Context, r *stock.StockIdList) (*stock.StrainList, error)
- func (s *StockService) ListStrainsByIds(ctx context.Context, r *stock.StockIdList) (*stock.StrainList, error)
- func (s *StockService) LoadPlasmid(ctx context.Context, req *stock.ExistingPlasmid) (*stock.Plasmid, error)
- func (s *StockService) LoadStrain(ctx context.Context, r *stock.ExistingStrain) (*stock.Strain, error)
- func (s *StockService) OboJSONFileUpload(stream stock.StockService_OboJSONFileUploadServer) error
- func (s *StockService) RemoveStock(ctx context.Context, r *stock.StockId) (*empty.Empty, error)
- func (s *StockService) SearchStock(ctx context.Context, r *stock.StockSearchParameters) (*stock.StockSearchResultCollection, error)
- func (s *StockService) UpdatePlasmid(ctx context.Context, req *stock.PlasmidUpdate) (*stock.Plasmid, error)
- func (s *StockService) UpdateStrain(ctx context.Context, r *stock.StrainUpdate) (*stock.Strain, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextualConverter ¶
type ContextualConverter = func(context.Context) PlasmidConverter
Level 3: Context-Aware Types - Context-parameterized transformations ContextualConverter is a converter factory that needs context
type ContextualErrorHandler ¶
ContextualErrorHandler wraps errors with context
type MockPublisher ¶
type MockPublisher struct{}
MockPublisher is a mock implementation of the message.Publisher interface.
func (*MockPublisher) Close ¶
func (mp *MockPublisher) Close() error
Close is a no-op mock implementation for testing
func (*MockPublisher) PublishPlasmid ¶
func (mp *MockPublisher) PublishPlasmid( _ string, _ *stock.Plasmid, ) error
PublishPlasmid is a no-op mock implementation for testing
func (*MockPublisher) PublishStrain ¶
func (mp *MockPublisher) PublishStrain( _ string, _ *stock.Strain, ) error
PublishStrain is a no-op mock implementation for testing
type PlasmidCollectionConverter ¶
type PlasmidCollectionConverter = func(PlasmidCollectionIO) PlasmidCollectionResult
PlasmidCollectionConverter converts IOEither to Go's tuple result
type PlasmidCollectionEither ¶
type PlasmidCollectionEither = E.Either[error, *stock.PlasmidCollection]
PlasmidCollectionEither represents computation that may succeed with collection or fail
type PlasmidCollectionIO ¶
type PlasmidCollectionIO = IOE.IOEither[error, *stock.PlasmidCollection]
PlasmidCollectionIO represents an IO computation for plasmid collection retrieval
type PlasmidCollectionResult ¶
type PlasmidCollectionResult = T.Tuple2[*stock.PlasmidCollection, error]
Result types for ListPlasmids PlasmidCollectionResult represents a plasmid collection with potential error
type PlasmidConverter ¶
type PlasmidConverter = func(PlasmidIO) PlasmidResult
Level 2: Transformers and Converters - Function type aliases for transformations PlasmidConverter converts IOEither to Go's tuple result
type PlasmidEither ¶
PlasmidEither represents a computation that may succeed with plasmid or fail
type PlasmidIOExecutor ¶
type PlasmidIOExecutor = func(PlasmidIO) PlasmidEither
PlasmidIOExecutor executes an IOEither to get Either
type PlasmidPublisher ¶
PlasmidPublisher is a type alias for the message publisher interface
type PlasmidResult ¶
Level 1: Basic Building Blocks - Core result types PlasmidResult represents a plasmid with potential error
type PlasmidResultFolder ¶
type PlasmidResultFolder = func(PlasmidEither) PlasmidResult
PlasmidResultFolder folds Either into tuple result
type StockRepository ¶
type StockRepository = repository.StockRepository
StockRepository is a type alias for the repository interface
type StockService ¶
type StockService struct {
*aphgrpc.Service
stock.UnimplementedStockServiceServer
// contains filtered or unexported fields
}
StockService is the container for managing stock service definition
func NewStockService ¶
func NewStockService( repo repository.StockRepository, pub message.Publisher, opt ...aphgrpc.Option, ) *StockService
NewStockService is the constructor for creating a new instance of StockService
func (*StockService) AutocompleteStock ¶
func (s *StockService) AutocompleteStock( ctx context.Context, r *stock.StockAutocompleteParameters, ) (*stock.StockSuggestionCollection, error)
AutocompleteStock returns short suggestions for a partial stock identifier, name or attribute value. The program is an IOEither from the boundary input to the edge: the pure request validation enters it through ChainEitherK, the repository search and the proto mapping follow, and the last step forces it into the collection and the status error. Every fault carries its own status code from the step that knows its class, so no fault classification happens at the edge. The request context stays unused: status.Error is pure, and the repository search takes no context.
func (*StockService) CountStocks ¶ added in v1.5.0
func (s *StockService) CountStocks( ctx context.Context, _ *empty.Empty, ) (*stock.StockCounts, error)
CountStocks returns totals and subtype counts for all strains and plasmids.
func (*StockService) CreatePlasmid ¶
func (s *StockService) CreatePlasmid( ctx context.Context, req *stock.NewPlasmid, ) (*stock.Plasmid, error)
CreatePlasmid handles the creation of a new plasmid using IOEither composition
func (*StockService) CreateStrain ¶
func (s *StockService) CreateStrain( ctx context.Context, r *stock.NewStrain, ) (*stock.Strain, error)
CreateStrain handles the creation of a new strain
func (*StockService) GetPlasmid ¶
func (s *StockService) GetPlasmid( ctx context.Context, req *stock.StockId, ) (*stock.Plasmid, error)
GetPlasmid handles getting a plasmid by its ID using IOEither composition
func (*StockService) ListPlasmids ¶
func (s *StockService) ListPlasmids( ctx context.Context, param *stock.StockParameters, ) (*stock.PlasmidCollection, error)
ListPlasmids lists all existing plasmids using IOEither composition
func (*StockService) ListStrains ¶
func (s *StockService) ListStrains( ctx context.Context, param *stock.StockParameters, ) (*stock.StrainCollection, error)
ListStrains lists all existing strains
func (*StockService) ListStrainsByIDs ¶
func (s *StockService) ListStrainsByIDs( ctx context.Context, r *stock.StockIdList, ) (*stock.StrainList, error)
ListStrainsByIDs gets a list of strains from a list of strain identifiers
func (*StockService) ListStrainsByIds ¶
func (s *StockService) ListStrainsByIds( ctx context.Context, r *stock.StockIdList, ) (*stock.StrainList, error)
ListStrainsByIds gets a list of strains from a list of strain identifiers. This method implements the proto-generated interface with the exact naming convention.
func (*StockService) LoadPlasmid ¶
func (s *StockService) LoadPlasmid( ctx context.Context, req *stock.ExistingPlasmid, ) (*stock.Plasmid, error)
LoadPlasmid loads plasmids with existing IDs into the database using IOEither composition
func (*StockService) LoadStrain ¶
func (s *StockService) LoadStrain( ctx context.Context, r *stock.ExistingStrain, ) (*stock.Strain, error)
LoadStrain loads strains with existing IDs into the database
func (*StockService) OboJSONFileUpload ¶
func (s *StockService) OboJSONFileUpload( stream stock.StockService_OboJSONFileUploadServer, ) error
OboJSONFileUpload handles streaming upload of OBO JSON ontology files
func (*StockService) RemoveStock ¶
RemoveStock removes an existing stock
func (*StockService) SearchStock ¶
func (s *StockService) SearchStock( ctx context.Context, r *stock.StockSearchParameters, ) (*stock.StockSearchResultCollection, error)
SearchStock returns at most 50 ranked results for a search text of at least 2 characters. The program is an IOEither from the boundary input to the edge: the pure request validation enters it through ChainEitherK, the repository search and the proto mapping follow, and the last step forces it into the collection and the status error. Every fault carries its own status code from the step that knows its class, so no fault classification happens at the edge. The request context stays unused: status.Error is pure, and the repository search takes no context.
func (*StockService) UpdatePlasmid ¶
func (s *StockService) UpdatePlasmid( ctx context.Context, req *stock.PlasmidUpdate, ) (*stock.Plasmid, error)
UpdatePlasmid handles updating an existing plasmid using IOEither composition
func (*StockService) UpdateStrain ¶
func (s *StockService) UpdateStrain( ctx context.Context, r *stock.StrainUpdate, ) (*stock.Strain, error)
UpdateStrain handles updating an existing strain