Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate jni bindings #1380

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/achcli/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func dumpFiles(paths []string, validateOpts *ach.ValidateOpts) error {
if !*flagMerge {
fmt.Printf("Describing ACH file '%s'\n\n", paths[i])
}
if files[i] != nil {
if &files[i] != nil {
describe.File(os.Stdout, files[i], &describe.Opts{
MaskAccountNumbers: *flagMask || *flagMaskAccounts,
MaskCorrectedData: *flagMask || *flagMaskCorrectedData,
Expand Down
2 changes: 1 addition & 1 deletion cmd/achcli/describe/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Opts struct {
}

func File(ww io.Writer, file *ach.File, opts *Opts) {
if file == nil {
if &file == nil {
return
}
if opts == nil {
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/moov-io/iso4217 v0.3.0
github.com/prometheus/client_golang v1.18.0
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.20.0
golang.org/x/net v0.21.0
golang.org/x/text v0.14.0
)

Expand All @@ -31,7 +31,10 @@ require (
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rickar/cal/v2 v2.1.13 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/mobile v0.0.0-20240213143359-d1f7d3436075 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 10 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00lCDlaYPg=
github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/aws/aws-lambda-go v1.45.0 h1:3xS35Dlc8ffmcwfcKTyqJGiMuL0UDvkQaVUrI5yHycI=
github.com/aws/aws-lambda-go v1.45.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A=
github.com/aws/aws-lambda-go v1.46.0 h1:UWVnvh2h2gecOlFhHQfIPQcD8pL/f7pVCutmFl+oXU8=
github.com/aws/aws-lambda-go v1.46.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -59,17 +57,23 @@ github.com/rickar/cal/v2 v2.1.13/go.mod h1:/fdlMcx7GjPlIBibMzOM9gMvDBsrK+mOtRXdT
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/mobile v0.0.0-20240213143359-d1f7d3436075 h1:iZzqyDd8gFkJZpsJNzveyScRBcQlsveheh6Q77LzhPY=
golang.org/x/mobile v0.0.0-20240213143359-d1f7d3436075/go.mod h1:Y8Bnziw2dX69ZhYuqQB8Ihyjks1Q6fMmbg17j9+ISNA=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
29 changes: 29 additions & 0 deletions javainterop/nextEntry.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package javainterop
midepeter marked this conversation as resolved.
Show resolved Hide resolved

import (
"io"

"github.com/moov-io/ach"
)

type EntryDetail ach.EntryDetail

type BatchHeader ach.BatchHeader

type Iterator ach.Iterator

type NextEntryResponse struct {
NextBatchHeader BatchHeader
NextEntryDetail EntryDetail
NextEntryError error
}

func (i *Iterator) NextEntry(r io.Reader) NextEntryResponse {
batchHeader, entryFile, err := ach.NewIterator(r).NextEntry()

return NextEntryResponse{
NextBatchHeader: BatchHeader(*batchHeader),
NextEntryDetail: EntryDetail(*entryFile),
NextEntryError: err,
}
midepeter marked this conversation as resolved.
Show resolved Hide resolved
}
23 changes: 23 additions & 0 deletions javainterop/segmentFile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package javainterop

import (
"github.com/moov-io/ach"
)

type File ach.File

type SegmentFileResponse struct {
CreditEntryFile *File
DebitEntryFile *File
SegmentFileError error
}

func (f *File) SegmentFile(config *ach.SegmentFileConfiguration) SegmentFileResponse {
creditFile, debitFile, err := ach.NewFile().SegmentFile(config)

return SegmentFileResponse{
CreditEntryFile: (*File)(creditFile),
DebitEntryFile: (*File)(debitFile),
SegmentFileError: err,
}
}
2 changes: 1 addition & 1 deletion merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func MergeFilesWith(files []*File, conditions Conditions) ([]*File, error) {
func mergeFilesHelper(files []*File, conditions Conditions) ([]*File, error) {
fs := &mergableFiles{infiles: files}
for i := range fs.infiles {
if fs.infiles[i] == nil {
if &fs.infiles[i] == nil {
continue // skip nil Files
}
outf := fs.findOutfile(fs.infiles[i])
Expand Down