diff --git a/go.mod b/go.mod index e965dd2d..2569906c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/conductorone/baton-retool go 1.20 require ( - github.com/conductorone/baton-sdk v0.1.21 + github.com/conductorone/baton-sdk v0.1.22 github.com/georgysavva/scany v1.2.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/jackc/pgx/v4 v4.18.1 diff --git a/go.sum b/go.sum index c9adbdec..4448dcd1 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs= github.com/cockroachdb/cockroach-go/v2 v2.2.0/go.mod h1:u3MiKYGupPPjkn3ozknpMUpxPaNLTFWAya419/zv6eI= -github.com/conductorone/baton-sdk v0.1.21 h1:lFNAtBi/XUzhEfNMA/4LnvaVYbWHpy4PZz4kFMZMKDw= -github.com/conductorone/baton-sdk v0.1.21/go.mod h1:1VMycIep+HU8JXef2wenT3ECzx1w3Jr3KDQG+L6Mv30= +github.com/conductorone/baton-sdk v0.1.22 h1:9IX0q8oPVfuHyvXdLbxCRGgqhjp/SqGv8T1RbiM1Tps= +github.com/conductorone/baton-sdk v0.1.22/go.mod h1:1VMycIep+HU8JXef2wenT3ECzx1w3Jr3KDQG+L6Mv30= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go index 36234d57..b33d1c34 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go @@ -13,6 +13,11 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" ) +type pragma struct { + name string + value string +} + type C1File struct { rawDb *sql.DB db *goqu.Database @@ -22,6 +27,7 @@ type C1File struct { dbFilePath string dbUpdated bool tempDir string + pragmas []pragma } type C1FOption func(*C1File) @@ -32,6 +38,12 @@ func WithC1FTmpDir(tempDir string) C1FOption { } } +func WithC1FPragma(name string, value string) C1FOption { + return func(o *C1File) { + o.pragmas = append(o.pragmas, pragma{name, value}) + } +} + // Returns a C1File instance for the given db filepath. func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1File, error) { rawDB, err := sql.Open("sqlite", dbFilePath) @@ -59,7 +71,8 @@ func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1Fi } type c1zOptions struct { - tmpDir string + tmpDir string + pragmas []pragma } type C1ZOption func(*c1zOptions) @@ -69,6 +82,12 @@ func WithTmpDir(tmpDir string) C1ZOption { } } +func WithPragma(name string, value string) C1ZOption { + return func(o *c1zOptions) { + o.pragmas = append(o.pragmas, pragma{name, value}) + } +} + // Returns a new C1File instance with its state stored at the provided filename. func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) (*C1File, error) { options := &c1zOptions{} @@ -81,7 +100,12 @@ func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) ( return nil, err } - c1File, err := NewC1File(ctx, dbFilePath) + var c1fopts []C1FOption + for _, pragma := range options.pragmas { + c1fopts = append(c1fopts, WithC1FPragma(pragma.name, pragma.value)) + } + + c1File, err := NewC1File(ctx, dbFilePath, c1fopts...) if err != nil { return nil, err } @@ -143,6 +167,13 @@ func (c *C1File) init(ctx context.Context) error { } } + for _, pragma := range c.pragmas { + _, err := c.db.ExecContext(ctx, fmt.Sprintf("PRAGMA %s = %s", pragma.name, pragma.value)) + if err != nil { + return err + } + } + return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go index b40ce01f..badcef02 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go @@ -16,7 +16,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" ) -const maxPageSize = 100 +const maxPageSize = 250 var allTableDescriptors = []tableDescriptor{ resourceTypes, diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a664f04..912ec5f6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -140,7 +140,7 @@ github.com/aws/smithy-go/waiter # github.com/benbjohnson/clock v1.3.5 ## explicit; go 1.15 github.com/benbjohnson/clock -# github.com/conductorone/baton-sdk v0.1.21 +# github.com/conductorone/baton-sdk v0.1.22 ## explicit; go 1.20 github.com/conductorone/baton-sdk/internal/connector github.com/conductorone/baton-sdk/pb/c1/c1z/v1