Documentation
¶
Index ¶
- Variables
- func MakeCreateBatchEndpoint(s Service) endpoint.Endpoint
- func MakeCreateFileEndpoint(s Service, r Repository) endpoint.Endpoint
- func MakeDeleteBatchEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteFileEndpoint(s Service) endpoint.Endpoint
- func MakeGetBatchEndpoint(s Service) endpoint.Endpoint
- func MakeGetBatchesEndpoint(s Service) endpoint.Endpoint
- func MakeGetFileContentsEndpoint(s Service) endpoint.Endpoint
- func MakeGetFileEndpoint(s Service) endpoint.Endpoint
- func MakeGetFilesEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(s Service, repo Repository, logger log.Logger) http.Handler
- func MakeValidateFileEndpoint(s Service) endpoint.Endpoint
- func NextID() string
- type Endpoints
- type Middleware
- type Repository
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadRouting is returned when an expected path variable is missing, which is always programmer error. ErrBadRouting = fmt.Errorf("inconsistent mapping between route and handler, %s", bugReportHelp) ErrFoundABug = fmt.Errorf("Snuck into encodeError with err == nil, %s", bugReportHelp) MaxContentLength = 1 * 1024 * 1024 // bytes )
View Source
var ( ErrNotFound = errors.New("Not Found") ErrAlreadyExists = errors.New("Already Exists") )
Functions ¶
func MakeCreateBatchEndpoint ¶
MakeCreateFileEndpoint returns an endpoint via the passed service.
func MakeCreateFileEndpoint ¶
func MakeCreateFileEndpoint(s Service, r Repository) endpoint.Endpoint
MakeCreateFileEndpoint returns an endpoint via the passed service.
func MakeDeleteBatchEndpoint ¶
func MakeDeleteFileEndpoint ¶
func MakeGetBatchEndpoint ¶
func MakeGetBatchesEndpoint ¶
func MakeGetFileEndpoint ¶
MakeGetFileEndpoint returns an endpoint via the passed service. Primarily useful in a server.
func MakeGetFilesEndpoint ¶
func MakeHTTPHandler ¶
Types ¶
type Endpoints ¶
type Endpoints struct { CreateFileEndpoint endpoint.Endpoint GetFileEndpoint endpoint.Endpoint GetFilesEndpoint endpoint.Endpoint DeleteFileEndpoint endpoint.Endpoint GetFileContentsEndpoint endpoint.Endpoint ValidateFileEndpoint endpoint.Endpoint CreateBatchEndpoint endpoint.Endpoint GetBatchesEndpoint endpoint.Endpoint GetBatchEndpoint endpoint.Endpoint DeleteBatchEndpoint endpoint.Endpoint }
func MakeServerEndpoints ¶
func MakeServerEndpoints(s Service, r Repository) Endpoints
type Middleware ¶
Middleware describes a service (as opposed to endpoint) middleware.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
type Repository ¶
type Repository interface { StoreFile(file *ach.File) error FindFile(id string) (*ach.File, error) FindAllFiles() []*ach.File DeleteFile(id string) error StoreBatch(fileID string, batch ach.Batcher) error FindBatch(fileID string, batchID string) (ach.Batcher, error) FindAllBatches(fileID string) []ach.Batcher DeleteBatch(fileID string, batchID string) error }
Repository is the Service storage mechanism abstraction
func NewRepositoryInMemory ¶
func NewRepositoryInMemory() Repository
NewRepositoryInMemory is an in memory ach storage repository for files
type Service ¶
type Service interface { // CreateFile creates a new ach file record and returns a resource ID CreateFile(f *ach.FileHeader) (string, error) // AddFile retrieves a file based on the File id GetFile(id string) (*ach.File, error) // GetFiles retrieves all files accessible from the client. GetFiles() []*ach.File // DeleteFile takes a file resource ID and deletes it from the store DeleteFile(id string) error // GetFileContents creates a valid plaintext file in memory assuming it has a FileHeader and at least one Batch record. GetFileContents(id string) (io.Reader, error) // ValidateFile ValidateFile(id string) error // CreateBatch creates a new batch within and ach file and returns its resource ID CreateBatch(fileID string, bh *ach.BatchHeader) (string, error) // GetBatch retrieves a batch based oin the file id and batch id GetBatch(fileID string, batchID string) (ach.Batcher, error) // GetBatches retrieves all batches associated with the file id. GetBatches(fileID string) []ach.Batcher // DeleteBatch takes a fileID and BatchID and removes the batch from the file DeleteBatch(fileID string, batchID string) error }
Service is a REST interface for interacting with ACH file structures TODO: Add ctx to function parameters to pass the client security token
Click to show internal directories.
Click to hide internal directories.