Skip to content

Commit

Permalink
update s3 config
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtwinkle committed Nov 21, 2023
1 parent 1858d56 commit f22dc6c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion aws/awss3/awss3.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func SelectCSVAll(ctx context.Context, region awsconfig.Region, bucketName Bucke
},
},
}
if c.SkipByteSize > 0 {
if c.SkipByteSize != nil {
req.ScanRange = &types.ScanRange{Start: c.SkipByteSize}
}
resp, err := client.SelectObjectContent(ctx, req)
Expand Down
12 changes: 6 additions & 6 deletions aws/awss3/awss3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestHeadObject(t *testing.T) {
key := createFixture(100)
res, err := awss3.HeadObject(ctx, TestRegion, TestBucket, key)
assert.NoError(t, err)
assert.Equal(t, int64(100), res.ContentLength)
assert.Equal(t, aws.Int64(100), res.ContentLength)
})
t.Run("not exists object", func(t *testing.T) {
t.Parallel()
Expand All @@ -83,7 +83,7 @@ func TestHeadObject(t *testing.T) {
s3head.WithTimeout(5*time.Second),
)
assert.NoError(t, err)
assert.Equal(t, int64(100), res.ContentLength)
assert.Equal(t, aws.Int64(100), res.ContentLength)
})
t.Run("not exists object use Waiter", func(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -781,7 +781,7 @@ func TestSelectCSVAll(t *testing.T) {
key := createFixture(ctx, src)
var buf bytes.Buffer
err := awss3.SelectCSVAll(ctx, TestRegion, TestBucket, key, awss3.SelectCSVAllQuery, &buf,
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: true}),
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: aws.Bool(true)}),
)
if !assert.NoError(t, err) {
return
Expand All @@ -803,7 +803,7 @@ func TestSelectCSVAll(t *testing.T) {
key := createFixture(ctx, src)
var buf bytes.Buffer
err := awss3.SelectCSVAll(ctx, TestRegion, TestBucket, key, awss3.SelectCSVAllQuery, &buf,
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: true}),
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: aws.Bool(true)}),
)
if !assert.NoError(t, err) {
return
Expand All @@ -825,7 +825,7 @@ func TestSelectCSVAll(t *testing.T) {
key := createFixture(ctx, src)
var buf bytes.Buffer
err := awss3.SelectCSVAll(ctx, TestRegion, TestBucket, key, awss3.SelectCSVAllQuery, &buf,
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: true}),
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: aws.Bool(true)}),
)
if !assert.NoError(t, err) {
return
Expand All @@ -847,7 +847,7 @@ func TestSelectCSVAll(t *testing.T) {
key := createFixture(ctx, src)
var buf bytes.Buffer
err := awss3.SelectCSVAll(ctx, TestRegion, TestBucket, key, awss3.SelectCSVAllQuery, &buf,
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: true}),
s3selectcsv.WithCSVInput(types.CSVInput{AllowQuotedRecordDelimiter: aws.Bool(true)}),
)

if !assert.NoError(t, err) {
Expand Down
2 changes: 1 addition & 1 deletion aws/awss3/options/global/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ func TestGlobalOptionWithHeadObject(t *testing.T) {
awss3.GlobalDialer = dialer
res, err := awss3.HeadObject(ctx, TestRegion, TestBucket, key)
assert.NoError(t, err)
assert.Equal(t, int64(100), res.ContentLength)
assert.Equal(t, aws.Int64(100), res.ContentLength)
})
}
5 changes: 3 additions & 2 deletions aws/awss3/options/s3selectcsv/s3_select_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type OptionS3SelectCSV interface {
}

type confS3SelectCSV struct {
SkipByteSize int64
SkipByteSize *int64
CSVInput types.CSVInput
CompressionType types.CompressionType
CSVOutput types.CSVOutput
Expand All @@ -28,7 +28,8 @@ func GetS3SelectCSVConf(opts ...OptionS3SelectCSV) confS3SelectCSV {
type OptionSkipByteSize int64

func (o OptionSkipByteSize) Apply(c *confS3SelectCSV) {
c.SkipByteSize = int64(o)
v := int64(o)
c.SkipByteSize = &v
}

// WithSkipByteSize
Expand Down
2 changes: 1 addition & 1 deletion aws/awssqs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func GetClient(ctx context.Context, region awsconfig.Region) (*sqs.Client, error
if localProfile, ok := getLocalEndpoint(ctx); ok {
return getClientLocal(ctx, *localProfile)
}
// S3 Client
// SQS Client
awsCfg, err := awsConfig.LoadDefaultConfig(ctx, awsConfig.WithRegion(region.String()))
if err != nil {
return nil, fmt.Errorf("unable to load SDK config, %w", err)
Expand Down

0 comments on commit f22dc6c

Please sign in to comment.