Skip to content

Commit d68bb54

Browse files
committed
public package name
1 parent 39d627d commit d68bb54

File tree

13 files changed

+121
-84
lines changed

13 files changed

+121
-84
lines changed

.example/main.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import (
55
"embed"
66
"encoding/json"
77
"fmt"
8-
"github.com/DTSL/go-bigtable-access-layer/repository"
98
"io"
109
"log"
1110
"os"
1211
"time"
1312

1413
"cloud.google.com/go/bigtable"
15-
"github.com/DTSL/go-bigtable-access-layer/aggregation"
16-
"github.com/DTSL/go-bigtable-access-layer/mapping"
14+
"github.com/sendinblue/bigtable-access-layer/aggregation"
15+
"github.com/sendinblue/bigtable-access-layer/mapping"
16+
"github.com/sendinblue/bigtable-access-layer/repository"
1717
)
1818

1919
const (
@@ -74,8 +74,8 @@ func readAndUseMapping(ctx context.Context, client *bigtable.Client, out io.Writ
7474
cols, events := mapper.GetMappedEvents(items)
7575
fmt.Fprintf(out, "Columns: %+v\n", cols)
7676
for _, event := range events {
77-
fmt.Fprintf(out, "Event: %+v\n", event)
78-
}
77+
fmt.Fprintf(out, "Event: %+v\n", event)
78+
}
7979
}
8080
return nil
8181
}
@@ -110,9 +110,9 @@ func aggregate(ctx context.Context, client *bigtable.Client, out io.Writer, tabl
110110
}
111111
j, err := json.Marshal(jsonOutput)
112112
if err != nil {
113-
_,_ = fmt.Fprintf(out, "error while formatting JSON: %v. Delivering the raw content instead:\n %+v \n", err, jsonOutput)
113+
_, _ = fmt.Fprintf(out, "error while formatting JSON: %v. Delivering the raw content instead:\n %+v \n", err, jsonOutput)
114114
}
115-
_,_ = fmt.Fprintf(out, "%s\n", j)
115+
_, _ = fmt.Fprintf(out, "%s\n", j)
116116
return nil
117117
}
118118

@@ -129,8 +129,8 @@ func printTwoEvents(ctx context.Context, client *bigtable.Client, out io.Writer,
129129
repo := repository.NewRepository(client.Open(table), mapper)
130130
eventSet, err := repo.Read(ctx, "contact-3")
131131
if err != nil {
132-
return err
133-
}
132+
return err
133+
}
134134
jsonOutput := make(map[string]interface{})
135135
jsonOutput["columns"] = eventSet.Columns
136136
for fam, events := range eventSet.Events {
@@ -139,9 +139,9 @@ func printTwoEvents(ctx context.Context, client *bigtable.Client, out io.Writer,
139139
}
140140
j, err := json.Marshal(jsonOutput)
141141
if err != nil {
142-
_,_ = fmt.Fprintf(out, "error while formatting JSON: %v. Delivering the raw content instead:\n %+v \n", err, jsonOutput)
143-
}
144-
_,_ = fmt.Fprintf(out, "%s\n", j)
142+
_, _ = fmt.Fprintf(out, "error while formatting JSON: %v. Delivering the raw content instead:\n %+v \n", err, jsonOutput)
143+
}
144+
_, _ = fmt.Fprintf(out, "%s\n", j)
145145
return nil
146146
}
147147

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 DTSL
3+
Copyright (c) 2021-2022 Sendinblue
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# go-bigtable-access-layer
1+
# bigtable-access-layer
22

3-
[![Maintainability](https://api.codeclimate.com/v1/badges/e06e7c0df20da7a298fc/maintainability)](https://codeclimate.com/repos/619e604df3947401b701334c/maintainability)
4-
[![Test Coverage](https://api.codeclimate.com/v1/badges/e06e7c0df20da7a298fc/test_coverage)](https://codeclimate.com/repos/619e604df3947401b701334c/test_coverage)
5-
6-
7-
`go-bigtable-access-layer` is a library designed to ease reading data from Big Table. it features:
3+
`bigtable-access-layer` is a library designed to ease reading data from Big Table. it features:
84

95
- cells grouping to build events using the timestamp
106
- schema mapping to transform the data into a human-readable format
@@ -133,20 +129,6 @@ for name, event := range groupByEventAndDevice {
133129
}
134130
```
135131

136-
## Documentation
137-
138-
### Godoc
139-
140-
To browse the documentation, you can use `godoc` in the root folder of the library.
141-
142-
```shell
143-
go get -u golang.org/x/tools/godoc
144-
cd $GOPATH/src/github.com/DTSL/go-bigtable-access-layer
145-
godoc
146-
```
147-
148-
Then head to http://localhost:6060/pkg/github.com/DTSL/go-bigtable-access-layer/
149-
150132
### Example code
151133

152134
Please see the code in the ['example folder](.example) for a complete example that you can run on your local machine using the emulator provided with Google Cloud SDK.

aggregation/aggregate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Package aggregation provides aggregation functions to group events as if we were using SQL statement such as GROUP BY.
3-
*/
3+
*/
44
/*
55
Two main functions are provided:
66
- GetLatestBy to get the latest event for each group. A group is defined by one or more columns.
@@ -13,7 +13,7 @@ package aggregation
1313
import (
1414
"strconv"
1515

16-
"github.com/DTSL/go-bigtable-access-layer/data"
16+
"github.com/sendinblue/bigtable-access-layer/data"
1717
)
1818

1919
// GetLatestBy groups lines by the given columns keeping the most recent one, thus without performing any aggregation.
@@ -91,8 +91,8 @@ func NewMax(column string, projection string) *Max {
9191

9292
func (m *Max) Compute(e *data.Event, events []*data.Event) *data.Event {
9393
e.Cells[m.projection] = selectOne(e, events, m.column, func(c, s float64) bool {
94-
return c > s
95-
})
94+
return c > s
95+
})
9696
return e
9797
}
9898

aggregation/aggregate_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ import (
55
"cloud.google.com/go/bigtable/bttest"
66
"context"
77
"fmt"
8-
"github.com/DTSL/go-bigtable-access-layer/mapping"
9-
"github.com/DTSL/go-bigtable-access-layer/repository"
8+
"github.com/sendinblue/bigtable-access-layer/mapping"
9+
"github.com/sendinblue/bigtable-access-layer/repository"
1010
"google.golang.org/api/option"
1111
"google.golang.org/grpc"
1212
"log"
1313
"testing"
1414
"time"
1515

16-
"github.com/DTSL/go-bigtable-access-layer/data"
16+
"github.com/sendinblue/bigtable-access-layer/data"
1717
)
1818

1919
const (
20-
projectID = "project-id"
20+
projectID = "project-id"
2121
instance = "instance-id"
2222
table = "ecommerce_events"
2323
columnFamily = "front"
@@ -405,7 +405,7 @@ func TestAverage_Compute(t *testing.T) {
405405
},
406406
},
407407
}
408-
comp(t, result, expected)
408+
comp(t, result, expected)
409409
}
410410

411411
func TestSum_Compute(t *testing.T) {
@@ -734,11 +734,11 @@ func comp(t *testing.T, result, expected map[string]*data.Event) {
734734
t.Fatalf("wrong number of events, wanted: %v, got :%v \n", len(expected), len(result))
735735
}
736736
for name, events := range result {
737-
if _, ok := expected[name]; ! ok {
737+
if _, ok := expected[name]; !ok {
738738
t.Fatalf("unexpected group %s \n", name)
739739
}
740740
for cname, cvalue := range events.Cells {
741-
if v, ok := expected[name].Cells[cname]; ! ok {
741+
if v, ok := expected[name].Cells[cname]; !ok {
742742
t.Fatalf("unexpected column")
743743
} else {
744744
if cvalue != v {
@@ -810,7 +810,7 @@ func generateMutations(numEvents int) []*bigtable.Mutation {
810810
default:
811811
mut.Set("front", "1", t, []byte("1"))
812812
}
813-
mut.Set("front", "a", t, []byte(fmt.Sprintf("%d", mod * 10)))
813+
mut.Set("front", "a", t, []byte(fmt.Sprintf("%d", mod*10)))
814814
mut.Set("front", "d", t, []byte(fmt.Sprintf("%d", 1+(i%2))))
815815
mutations = append(mutations, mut)
816816
}

doc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
Copyright 2021 Sendinblue S.A.S
3-
*/
3+
*/
44

55
/*
6-
Package go_bigtable_access_layer is a library designed to ease reading data from Big Table. it features:
6+
Package bigtable_access_layer is a library designed to ease reading data from Big Table. it features:
77
88
- Cells grouping to build events using the timestamp
99
- Schema mapping to transform the data into a human-readable format
@@ -123,4 +123,4 @@ the required logic to search filtered data and collect all properties for each e
123123
}
124124
125125
*/
126-
package go_bigtable_access_layer // import "github.com/sendinblue/go-bigtable-access-layer"
126+
package bigtable_access_layer // import "github.com/sendinblue/bigtable-access-layer"

go.mod

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1-
module github.com/DTSL/go-bigtable-access-layer
1+
module github.com/sendinblue/bigtable-access-layer
22

33
go 1.17
44

55
require (
6-
cloud.google.com/go/bigtable v1.11.0
7-
google.golang.org/api v0.59.0
8-
google.golang.org/grpc v1.40.0
6+
cloud.google.com/go/bigtable v1.13.0
7+
google.golang.org/api v0.70.0
8+
google.golang.org/grpc v1.44.0
99
)
1010

1111
require (
12-
cloud.google.com/go v0.97.0 // indirect
12+
cloud.google.com/go v0.100.2 // indirect
13+
cloud.google.com/go/compute v1.3.0 // indirect
14+
cloud.google.com/go/iam v0.1.1 // indirect
15+
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
16+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
17+
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
18+
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
19+
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021 // indirect
20+
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
1321
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
1422
github.com/golang/protobuf v1.5.2 // indirect
1523
github.com/google/btree v1.0.1 // indirect
16-
github.com/google/go-cmp v0.5.6 // indirect
24+
github.com/google/go-cmp v0.5.7 // indirect
1725
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
1826
go.opencensus.io v0.23.0 // indirect
19-
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect
20-
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect
21-
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect
22-
golang.org/x/text v0.3.6 // indirect
27+
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
28+
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
29+
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
30+
golang.org/x/text v0.3.7 // indirect
2331
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
2432
google.golang.org/appengine v1.6.7 // indirect
25-
google.golang.org/genproto v0.0.0-20211027162914-98a5263abeca // indirect
33+
google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c // indirect
2634
google.golang.org/protobuf v1.27.1 // indirect
2735
rsc.io/binaryregexp v0.2.0 // indirect
2836
)

0 commit comments

Comments
 (0)