Documentation
¶
Index ¶
- Variables
- func ConfigureMaxBodySizeFromEnv() (int64, error)
- func GetLineEnding(r *http.Request) string
- func MakeHTTPHandler(s Service, repo Repository, kitlog gokitlog.Logger) http.Handler
- func MaxBodySize() int64
- func ParseMaxBodySize(v string) (int64, error)
- func SetMaxBodySize(size int64)
- type Repository
- type Service
Constants ¶
This section is empty.
Variables ¶
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) )
var ( ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") )
Functions ¶
func ConfigureMaxBodySizeFromEnv ¶ added in v1.62.0
ConfigureMaxBodySizeFromEnv reads ACH_MAX_BODY_SIZE and applies it when set. Returns the configured size and true when the env var was present and valid.
func GetLineEnding ¶ added in v1.40.0
Inspects the `X-Line-Ending` header. If it is a valid value (CRLF | LF), returns the line ending associated with the selected enum value. Otherwise, defaults to Unix-style newline characters.
func MakeHTTPHandler ¶
func MaxBodySize ¶ added in v1.62.0
func MaxBodySize() int64
MaxBodySize returns the current maximum HTTP request body size in bytes.
func ParseMaxBodySize ¶ added in v1.62.0
ParseMaxBodySize parses a human-friendly size string into bytes using github.com/docker/go-units (binary units: KB/MB/GB are 1024-based). Plain integers are bytes. Examples: "12MB", "12M", "13107200", "1GB".
func SetMaxBodySize ¶ added in v1.62.0
func SetMaxBodySize(size int64)
SetMaxBodySize overrides the maximum HTTP request body size in bytes. Values less than or equal to zero are ignored.
Types ¶
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(ttl time.Duration, logger log.Logger) 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
// BuildFile tabulates file values according to the Nacha spec
BuildFile(id string) (*ach.File, error)
// 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, opts *ach.WriteOpts) (io.Reader, error)
// ValidateFile
ValidateFile(id string, opts *ach.ValidateOpts) error
// BalanceFile will apply a given offset record to the file
BalanceFile(fileID string, off *ach.Offset) (*ach.File, error)
// SegmentFileID segments an ach file
SegmentFileID(id string, opts *ach.SegmentFileConfiguration) (*ach.File, *ach.File, error)
// SegmentFile segments an ach file
SegmentFile(file *ach.File, opts *ach.SegmentFileConfiguration) (*ach.File, *ach.File, error)
// FlattenBatches will minimize the ach.Batch objects in a file by consolidating EntryDetails under distinct batch headers
FlattenBatches(id string) (*ach.File, error)
// CreateBatch creates a new batch within and ach file and returns its resource ID
CreateBatch(fileID string, bh ach.Batcher) (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
// MergeFiles will combine all the given files together
MergeFiles(fileIDs []string, files []*ach.File, conditions *ach.Conditions) ([]*ach.File, error)
// ReverseFile creates a NACHA compliant reversal of the ACH file
ReverseFile(fileID string, effectiveEntryDate time.Time) (*ach.File, error)
}
Service is a REST interface for interacting with ACH file structures TODO: Add ctx to function parameters to pass the client security token