Skip to content

Commit

Permalink
Change freeleh to freedb
Browse files Browse the repository at this point in the history
  • Loading branch information
edocsss committed Aug 28, 2022
1 parent ae2965f commit 1ce46b0
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 43 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GoFreeLeh
# GoFreeDB

![Unit Test](https://github.com/FreeLeh/GoFreeLeh/actions/workflows/unit_test.yml/badge.svg)
![Unit Test](https://github.com/FreeLeh/GoFreeDB/actions/workflows/unit_test.yml/badge.svg)

<div>
<h2 align="center">
Expand All @@ -11,13 +11,13 @@
</h2>
</div>

`GoFreeLeh` is a Golang library providing common and familiar interfaces on top of common free services we have access to.
`GoFreeDB` is a Golang library providing common and familiar interfaces on top of common free services we have access to.

## Why do you need this library?

Our main goal is to make developers who want to **just start their small personal projects so much easier without thinking too much about the setup required to get started**. We can leverage a bunch of well known free services available to us like Google Sheets and Telegram. We want to use these services as our **easy-to-setup and "managed" database or even a message queue**.

`GoFreeLeh` is just the beginning. It is very likely we will explore other languages (e.g. Java, Kotlin, Swift, etc.) to support in the future.
`GoFreeDB` is just the beginning. It is very likely we will explore other languages (e.g. Java, Kotlin, Swift, etc.) to support in the future.

> Check out [PyFreeLeh](https://github.com/FreeLeh/PyFreeLeh) for the Python version!
Expand All @@ -34,7 +34,7 @@ There are other ideas we have in our backlog:
2. A simple message queue on top of Telegram Channels.

We are quite open to knowing any other free services we can leverage on.<br>
Please suggest your ideas in the [issues](https://github.com/FreeLeh/GoFreeLeh/issues) page!
Please suggest your ideas in the [issues](https://github.com/FreeLeh/GoFreeDB/issues) page!

## What can I do with these interfaces/abstractions?

Expand Down Expand Up @@ -76,7 +76,7 @@ Here are a few ideas we thought of:
# Installation

```
go get github.com/FreeLeh/GoFreeLeh
go get github.com/FreeLeh/GoFreeDB
```

# Key Value Store
Expand All @@ -100,11 +100,11 @@ auth, err := auth.NewOAuth2FromFile(
)

// Below are the same regardless of the auth client chosen above.
kv := freeleh.NewGoogleSheetKVStore(
kv := freedb.NewGoogleSheetKVStore(
auth,
"<spreadsheet_id>",
"<sheet_name>",
freeleh.GoogleSheetKVStoreConfig{Mode: freeleh.KVSetModeAppendOnly},
freedb.GoogleSheetKVStoreConfig{Mode: freedb.KVSetModeAppendOnly},
)
defer kv.Close(context.Background())

Expand Down Expand Up @@ -155,10 +155,10 @@ There are 2 different modes supported:

```go
// Default mode
kv := freeleh.NewGoogleSheetKVStore(auth, "<spreadsheet_id>", "<sheet_name>", freeleh.GoogleSheetKVStoreConfig{Mode: freeleh.KVModeDefault})
kv := freedb.NewGoogleSheetKVStore(auth, "<spreadsheet_id>", "<sheet_name>", freedb.GoogleSheetKVStoreConfig{Mode: freedb.KVModeDefault})

// Append only mode
kv := freeleh.NewGoogleSheetKVStore(auth, "<spreadsheet_id>", "<sheet_name>", freeleh.GoogleSheetKVStoreConfig{Mode: freeleh.KVModeAppendOnly})
kv := freedb.NewGoogleSheetKVStore(auth, "<spreadsheet_id>", "<sheet_name>", freedb.GoogleSheetKVStoreConfig{Mode: freedb.KVModeAppendOnly})
```

#### Default Mode
Expand Down Expand Up @@ -250,11 +250,11 @@ auth, err := auth.NewOAuth2FromFile(
)

// Below are the same regardless of the auth client chosen above.
store := freeleh.NewGoogleSheetsRowStore(
store := freedb.NewGoogleSheetsRowStore(
auth,
"<spreadsheet_id>",
"<sheet_name>",
freeleh.GoogleSheetRowStoreConfig{Columns: []string{"name", "age"}},
freedb.GoogleSheetRowStoreConfig{Columns: []string{"name", "age"}},
)
defer store.Close(context.Background())

Expand Down Expand Up @@ -552,7 +552,7 @@ auth, err := auth.NewServiceFromFile(
1. If you want to manually edit the Google Sheet, you can do it, but you need to understand the value encoding scheme.
2. It is not easy to support concurrent operations. Only few modes or abstractions allow concurrent operations.
3. Performance is not a high priority for this project.
4. `GoFreeLeh` does not support OAuth2 flow that spans across frontend and backend yet.
4. `GoFreeDB` does not support OAuth2 flow that spans across frontend and backend yet.

### (Google Sheets Key Value) Exclamation Mark `!` Prefix

Expand Down Expand Up @@ -583,4 +583,4 @@ auth, err := auth.NewServiceFromFile(

# License

This project is [MIT licensed](https://github.com/FreeLeh/GoFreeLeh/blob/main/LICENSE).
This project is [MIT licensed](https://github.com/FreeLeh/GoFreeDB/blob/main/LICENSE).
2 changes: 1 addition & 1 deletion codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package freeleh
package freedb

import "errors"

Expand Down
2 changes: 1 addition & 1 deletion codec_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package freeleh
package freedb

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/FreeLeh/GoFreeLeh
module github.com/FreeLeh/GoFreeDB

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion google/auth/oauth2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/FreeLeh/GoFreeLeh/internal/google/fixtures"
"github.com/FreeLeh/GoFreeDB/internal/google/fixtures"
"github.com/stretchr/testify/assert"
"golang.org/x/oauth2"
)
Expand Down
2 changes: 1 addition & 1 deletion google/auth/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package auth
import (
"testing"

"github.com/FreeLeh/GoFreeLeh/internal/google/fixtures"
"github.com/FreeLeh/GoFreeDB/internal/google/fixtures"
"github.com/stretchr/testify/assert"
"golang.org/x/oauth2"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/google/sheets/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (w *Wrapper) execQueryRows(
) (rawQueryRowsResult, error) {
params := url.Values{}
params.Add("sheet", sheetName)
params.Add("tqx", "responseHandler:freeleh")
params.Add("tqx", "responseHandler:freedb")
params.Add("tq", query)

header := 0
Expand Down
8 changes: 4 additions & 4 deletions internal/google/sheets/wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"
"testing"

"github.com/FreeLeh/GoFreeLeh/google/auth"
"github.com/FreeLeh/GoFreeLeh/internal/google/fixtures"
"github.com/FreeLeh/GoFreeDB/google/auth"
"github.com/FreeLeh/GoFreeDB/internal/google/fixtures"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
)
Expand Down Expand Up @@ -589,13 +589,13 @@ func TestQueryRows(t *testing.T) {
t.Run("successful", func(t *testing.T) {
expectedParams := map[string]string{
"sheet": "s1",
"tqx": "responseHandler:freeleh",
"tqx": "responseHandler:freedb",
"tq": "select A, B",
"headers": "1",
}
resp := `
/*O_o*/
freeleh({"version":"0.6","reqId":"0","status":"ok","sig":"141753603","table":{"cols":[{"id":"A","label":"","type":"string"},{"id":"B","label":"","type":"number","pattern":"General"}],"rows":[{"c":[{"v":"k1"},{"v":103.51,"f":"103.51"}]},{"c":[{"v":"k2"},{"v":111.0,"f":"111"}]},{"c":[{"v":"k3"},{"v":123.0,"f":"123"}]}],"parsedNumHeaders":0}})
freedb({"version":"0.6","reqId":"0","status":"ok","sig":"141753603","table":{"cols":[{"id":"A","label":"","type":"string"},{"id":"B","label":"","type":"number","pattern":"General"}],"rows":[{"c":[{"v":"k1"},{"v":103.51,"f":"103.51"}]},{"c":[{"v":"k2"},{"v":111.0,"f":"111"}]},{"c":[{"v":"k3"},{"v":123.0,"f":"123"}]}],"parsedNumHeaders":0}})
`

gock.New("https://docs.google.com").
Expand Down
4 changes: 2 additions & 2 deletions kv.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package freeleh
package freedb

import (
"context"
"errors"
"fmt"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
)

// GoogleSheetKVStoreConfig defines a list of configurations that can be used to customise how the GoogleSheetKVStore works.
Expand Down
4 changes: 2 additions & 2 deletions kv_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package freeleh
package freedb

import (
"context"
"fmt"
"testing"

"github.com/FreeLeh/GoFreeLeh/google/auth"
"github.com/FreeLeh/GoFreeDB/google/auth"
"github.com/stretchr/testify/assert"
)

Expand Down
7 changes: 4 additions & 3 deletions models.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package freeleh
package freedb

import (
"context"
"errors"
"github.com/FreeLeh/GoFreeLeh/google/auth"
"regexp"
"strconv"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/google/auth"

"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
)

// KVMode defines the mode of the key value store.
Expand Down
2 changes: 1 addition & 1 deletion models_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package freeleh
package freedb

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions row.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package freeleh
package freedb

import (
"context"
"errors"
"fmt"
"time"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
)

// GoogleSheetRowStoreConfig defines a list of configurations that can be used to customise how the GoogleSheetRowStore works.
Expand Down
4 changes: 2 additions & 2 deletions row_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package freeleh
package freedb

import (
"context"
"fmt"
"testing"

"github.com/FreeLeh/GoFreeLeh/google/auth"
"github.com/FreeLeh/GoFreeDB/google/auth"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions stmt.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package freeleh
package freedb

import (
"context"
Expand All @@ -8,7 +8,7 @@ import (
"strconv"
"strings"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
)

type queryBuilder struct {
Expand Down
4 changes: 2 additions & 2 deletions stmt_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package freeleh
package freedb

import (
"context"
"errors"
"testing"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package freeleh
package freedb

import (
"context"
"time"

"github.com/FreeLeh/GoFreeLeh/internal/google/sheets"
"github.com/FreeLeh/GoFreeDB/internal/google/sheets"
"github.com/mitchellh/mapstructure"
)

Expand Down
2 changes: 1 addition & 1 deletion utils_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package freeleh
package freedb

import (
"testing"
Expand Down

0 comments on commit 1ce46b0

Please sign in to comment.