Skip to content

Commit 876c345

Browse files
committed
Change from common-go to core-go
1 parent 1681e54 commit 876c345

12 files changed

+29
-52
lines changed

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@
22
- DynamoDB Client Utilities
33

44
## Installation
5-
6-
Please make sure to initialize a Go module before installing common-go/dynamodb:
5+
Please make sure to initialize a Go module before installing core-go/dynamodb:
76

87
```shell
9-
go get -u github.com/common-go/dynamodb
8+
go get -u github.com/core-go/dynamodb
109
```
1110

1211
Import:
13-
1412
```go
15-
import "github.com/common-go/dynamodb"
16-
```
17-
18-
You can optimize the import by version:
19-
- v0.0.1: Utilities to support query, find one by Id
20-
- v0.0.4: Utilities to support insert, update, patch, upsert, delete
21-
- v0.0.7: Utilities to support batch update
22-
- v0.1.0: FieldLoader, ViewService and GenericService
23-
- v0.1.1: SearchService
13+
import "github.com/core-go/dynamodb"
14+
```

dynamodb.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ package dynamodb
33
import (
44
"context"
55
"fmt"
6-
"reflect"
7-
"strconv"
8-
"strings"
9-
106
"github.com/aws/aws-sdk-go/aws"
117
"github.com/aws/aws-sdk-go/aws/credentials"
128
"github.com/aws/aws-sdk-go/aws/session"
139
"github.com/aws/aws-sdk-go/service/dynamodb"
1410
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
1511
"github.com/aws/aws-sdk-go/service/dynamodb/expression"
12+
"reflect"
13+
"strconv"
14+
"strings"
1615
)
1716

1817
const (

dynamodb_health_checker.go renamed to health_checker.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@ package dynamodb
33
import (
44
"context"
55
"errors"
6-
"time"
7-
86
"github.com/aws/aws-sdk-go/service/dynamodb"
7+
"time"
98
)
109

11-
type DynamoDBHealthChecker struct {
10+
type HealthChecker struct {
1211
db *dynamodb.DynamoDB
1312
name string
1413
timeout time.Duration
1514
}
1615

17-
func NewDynamoDBHealthChecker(db *dynamodb.DynamoDB, name string, timeouts ...time.Duration) *DynamoDBHealthChecker {
16+
func NewDynamoDBHealthChecker(db *dynamodb.DynamoDB, name string, timeouts ...time.Duration) *HealthChecker {
1817
var timeout time.Duration
1918
if len(timeouts) >= 1 {
2019
timeout = timeouts[0]
2120
} else {
2221
timeout = 4 * time.Second
2322
}
24-
return &DynamoDBHealthChecker{db, name, timeout}
23+
return &HealthChecker{db, name, timeout}
2524
}
26-
func NewHealthChecker(db *dynamodb.DynamoDB, options ...string) *DynamoDBHealthChecker {
25+
func NewHealthChecker(db *dynamodb.DynamoDB, options ...string) *HealthChecker {
2726
var name string
2827
if len(options) > 0 && len(options[0]) > 0 {
2928
name = options[0]
@@ -33,11 +32,11 @@ func NewHealthChecker(db *dynamodb.DynamoDB, options ...string) *DynamoDBHealthC
3332
return NewDynamoDBHealthChecker(db, name, 4 * time.Second)
3433
}
3534

36-
func (s *DynamoDBHealthChecker) Name() string {
35+
func (s *HealthChecker) Name() string {
3736
return s.name
3837
}
3938

40-
func (s *DynamoDBHealthChecker) Check(ctx context.Context) (map[string]interface{}, error) {
39+
func (s *HealthChecker) Check(ctx context.Context) (map[string]interface{}, error) {
4140
res := make(map[string]interface{}, 0)
4241
if s.timeout > 0 {
4342
ctx, _ = context.WithTimeout(ctx, s.timeout)
@@ -61,7 +60,7 @@ func (s *DynamoDBHealthChecker) Check(ctx context.Context) (map[string]interface
6160
}
6261
}
6362

64-
func (s *DynamoDBHealthChecker) Build(ctx context.Context, data map[string]interface{}, err error) map[string]interface{} {
63+
func (s *HealthChecker) Build(ctx context.Context, data map[string]interface{}, err error) map[string]interface{} {
6564
if data == nil {
6665
data = make(map[string]interface{}, 0)
6766
}

loader.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package dynamodb
22

33
import (
44
"context"
5+
"github.com/aws/aws-sdk-go/service/dynamodb"
56
"log"
67
"reflect"
7-
8-
"github.com/aws/aws-sdk-go/service/dynamodb"
98
)
109

1110
type Loader struct {

passcode_repository.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package dynamodb
22

33
import (
44
"context"
5-
"time"
6-
75
"github.com/aws/aws-sdk-go/service/dynamodb"
6+
"time"
87
)
98

109
type PasscodeRepository struct {

query.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ package dynamodb
33
import (
44
"context"
55
"fmt"
6-
"reflect"
7-
"strings"
8-
96
"github.com/aws/aws-sdk-go/service/dynamodb"
107
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
118
"github.com/aws/aws-sdk-go/service/dynamodb/expression"
12-
13-
//"github.com/mitchellh/mapstructure"
14-
9+
"reflect"
10+
"strings"
1511
)
1612

1713
func BuildSearchResult(ctx context.Context, db *dynamodb.DynamoDB, results interface{}, query dynamodb.ScanInput, pageIndex int64, pageSize int64, initPageSize int64, options...func(context.Context, interface{}) (interface{}, error)) (int64, error) {

query/query_builder.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package query
22

33
import (
4+
"github.com/aws/aws-sdk-go/aws"
5+
"github.com/aws/aws-sdk-go/service/dynamodb"
6+
"github.com/aws/aws-sdk-go/service/dynamodb/expression"
7+
d "github.com/core-go/dynamodb"
8+
"github.com/core-go/search"
49
"log"
510
"reflect"
611
"strings"
712
"time"
8-
9-
"github.com/aws/aws-sdk-go/aws"
10-
"github.com/aws/aws-sdk-go/service/dynamodb"
11-
"github.com/aws/aws-sdk-go/service/dynamodb/expression"
12-
d "github.com/common-go/dynamodb"
13-
"github.com/common-go/search"
1413
)
1514

1615
type Builder struct {

search_builder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package dynamodb
22

33
import (
44
"context"
5-
"reflect"
6-
75
"github.com/aws/aws-sdk-go/service/dynamodb"
6+
"reflect"
87
)
98

109
type SearchBuilder struct {

search_load.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package dynamodb
22

33
import (
44
"context"
5-
"reflect"
6-
75
"github.com/aws/aws-sdk-go/service/dynamodb"
6+
"reflect"
87
)
98

109
func NewSearchLoaderWithQuery(db *dynamodb.DynamoDB, tableName string, modelType reflect.Type, partitionKeyName string, sortKeyName string, buildQuery func(interface{}) (dynamodb.ScanInput, error), options...func(context.Context, interface{}) (interface{}, error)) (*Searcher, *Loader) {

search_write.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package dynamodb
22

33
import (
44
"context"
5-
"reflect"
6-
75
"github.com/aws/aws-sdk-go/service/dynamodb"
6+
"reflect"
87
)
98

109
func NewSearchWriter(db *dynamodb.DynamoDB, tableName string, modelType reflect.Type, partitionKeyName string, sortKeyName string, buildQuery func(interface{}) (dynamodb.ScanInput, error), options ...Mapper) (*Searcher, *Writer) {

0 commit comments

Comments
 (0)