-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from tigrisdata/main
Beta release
- Loading branch information
Showing
53 changed files
with
3,821 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: go-lint | ||
on: | ||
push: | ||
workflow_call: | ||
secrets: | ||
CLIENT_DEPLOY_KEY: | ||
required: true | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.18' | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: latest | ||
skip-pkg-cache: true | ||
skip-build-cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: go-test | ||
on: | ||
push: | ||
workflow_call: | ||
permissions: | ||
contents: read | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.18' | ||
- run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: release-binaries | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
releases-matrix: | ||
name: Release Go Binaries | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux, windows, darwin] | ||
goarch: [amd64, arm64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: wangyoucao577/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
sha256sum: true | ||
build_command: make | ||
binary_name: tigris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: publish-binaries | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
package: | ||
uses: ./.github/workflows/package.yaml | ||
|
||
publish: | ||
needs: [package] | ||
name: Publish Go binaries | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Upload to shorts.io | ||
run: | | ||
API_KEY=${{secrets.SHORTS_IO_KEY}} VERSION=${GITHUB_REF/refs\/tags\//} /bin/bash scripts/publish.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: release | ||
on: | ||
push: | ||
branches: | ||
- "release" | ||
- "alpha" | ||
- "beta" | ||
- "rc" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
- name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }} | ||
run: npx semantic-release --debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
tigris | ||
|
||
# JSON files | ||
*.json | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# IntelliJ project files | ||
.idea | ||
*.iml | ||
out | ||
gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
branches: | ||
- name: rc | ||
prerelease: true | ||
- name: alpha | ||
prerelease: true | ||
- name: beta | ||
prerelease: true | ||
- release | ||
plugins: | ||
- "@semantic-release/commit-analyzer" | ||
- "@semantic-release/release-notes-generator" | ||
- "@semantic-release/github" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
VERSION=$(shell git describe --tags --always) | ||
GO_SRC=$(shell find . -name "*.go" -not -name "*_test.go") | ||
BIN=tigris | ||
ifeq ($(GOOS), windows) | ||
BIN=tigris.exe | ||
endif | ||
|
||
BUILD_PARAM=-tags=release -ldflags "-X 'main.Version=$(VERSION)'" $(shell printenv BUILD_PARAM) | ||
BUILD_PARAM=-tags=release -ldflags "-w -extldflags '-static' -X 'github.com/tigrisdata/tigris-cli/util.Version=$(VERSION)'" -o ${BIN} $(shell printenv BUILD_PARAM) | ||
TEST_PARAM=-cover -race -tags=test $(shell printenv TEST_PARAM) | ||
export GOPRIVATE=github.com/tigrisdata/tigrisdb-client-go | ||
|
||
all: ${GO_SRC} | ||
go build ${BUILD_PARAM} . | ||
all: ${BIN} | ||
|
||
${BIN}: ${GO_SRC} go.sum | ||
CGO_ENABLED=0 go build ${BUILD_PARAM} . | ||
|
||
lint: | ||
golangci-lint run | ||
shellcheck tests/*.sh | ||
|
||
go.sum: go.mod | ||
go mod download | ||
|
||
test: go.sum lint | ||
test: ${BIN} go.sum | ||
go test $(TEST_PARAM) ./... | ||
/bin/bash tests/*.sh | ||
|
||
install: ${BIN} | ||
install -d $(DESTDIR)$(PREFIX)/bin | ||
install -m 755 ${BIN} $(DESTDIR)$(PREFIX)/bin/ | ||
|
||
clean: | ||
rm -f ${BIN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,138 @@ | ||
# TigrisDB command line interface utility | ||
# Tigris Command Line Interface | ||
|
||
# Install | ||
[]() | ||
[]() | ||
|
||
```sh | ||
go install github.com/tigrisdata/tigrisdb-cli@latest | ||
Create databases and collections, read and write data, perform transactions, | ||
stream events and setup Tigris locally, all from the command line. | ||
|
||
# Documentation | ||
- [Quickstart](https://docs.tigrisdata.com/quickstart/with-cli) | ||
- [Working Locally](https://docs.tigrisdata.com/cli/working-locally) | ||
- [Command Reference](https://docs.tigrisdata.com/cli) | ||
|
||
# Installation | ||
|
||
The tigris CLI tool can be installed as follows: | ||
|
||
## macOS | ||
|
||
```shell | ||
curl -sSL https://tigris.dev/cli-macos | sudo tar -xz -C /usr/local/bin | ||
``` | ||
|
||
# Example | ||
## Linux | ||
|
||
export TIGRISDB_TOKEN={token from [here](https://dev.tigrisdata.cloud/gms/login)} | ||
```shell | ||
curl -sSL https://tigris.dev/cli-linux | sudo tar -xz -C /usr/local/bin | ||
``` | ||
|
||
```sh | ||
# Usage | ||
|
||
tigrisdb-cli create database db1 | ||
tigrisdb-cli create collection db1 coll1 \ | ||
'{"Key1" : "string", "Field1" : "int", "primary_key" : "Key1"}' | ||
```shell | ||
$ tigris | ||
tigris is the command line interface of Tigris data platform | ||
|
||
tigrisdb-cli list databases | ||
tigrisdb-cli list collections db1 | ||
Usage: | ||
tigris [command] | ||
|
||
tigrisdb-cli insert "db1" "coll1" '{"Key1": "vK1", "Field1": 1}' \ | ||
'{"Key1": "vK2", "Field1": 10}' | ||
Available Commands: | ||
alter alter collection | ||
completion Generate completion script | ||
create creates database or collection | ||
delete delete documents | ||
describe describe database or collection | ||
docs Generates CLI documentation in Markdown format | ||
drop drop database or collection | ||
events Streams and outputs events | ||
generate Generating helper assets such as sample schema | ||
help Help about any command | ||
insert insert document | ||
list list databases of the project or list database collections | ||
local Starting and stopping local Tigris server | ||
ping Check connection to Tigris | ||
read read documents | ||
replace replace document | ||
scaffold Scaffold a project for specified language | ||
search Searches a collection for documents matching the query | ||
server Tigris server related commands | ||
transact run a set of operations in a transaction | ||
update update documents | ||
version show tigris cli version | ||
|
||
tigrisdb-cli read "db1" "coll1" '{"Key1": "vK1"}' | ||
Flags: | ||
-h, --help help for tigris | ||
|
||
#Output: | ||
#{"Key1": "vK1", "Field1": 1} | ||
#{"Key1": "vK2", "Field1": 10} | ||
Use "tigris [command] --help" for more information about a command. | ||
``` | ||
|
||
tigrisdb-cli update "db1" "coll1" '{"Key1": "vK1"}' '{"Field1": 1000}' | ||
# Examples | ||
|
||
tigrisdb-cli delete "db1" "coll1" '{"Key1": "vK1"}' | ||
```shell | ||
# Start up Tigris locally on port 8081 | ||
tigris local up | ||
|
||
tigrisdb-cli drop collection db1 coll1 | ||
tigrisdb-cli drop database db1 | ||
# Create sample schema | ||
tigris generate sample-schema --create | ||
|
||
# Create database and collection | ||
tigris create database testdb | ||
tigris create collection testdb \ | ||
'{ | ||
"title": "users", | ||
"description": "Collection of documents with details of users", | ||
"properties": { | ||
"id": { | ||
"description": "A unique identifier for the user", | ||
"type": "integer" | ||
}, | ||
"name": { | ||
"description": "Name of the user", | ||
"type": "string", | ||
"maxLength": 100 | ||
} | ||
}, | ||
"primary_key": [ | ||
"id" | ||
] | ||
}' | ||
|
||
# Insert some data | ||
tigris insert_or_replace sampledb users \ | ||
'[ | ||
{"id": 1, "name": "Jania McGrory", "balance": 6045.7}, | ||
{"id": 2, "name": "Bunny Instone", "balance": 2948.87} | ||
]' | ||
|
||
# Read data | ||
tigris read sampledb users '{"id": 1}' | ||
|
||
# Perform a transaction | ||
tigris transact sampledb \ | ||
'[ | ||
{ | ||
"insert": { | ||
"collection": "orders", | ||
"documents": [{ | ||
"id": 1, "user_id": 1, "order_total": 53.89, "products": [{"id": 1, "quantity": 1}] | ||
}] | ||
} | ||
}, | ||
{ | ||
"update": { | ||
"collection": "users", "fields": {"$set": {"balance": 5991.81}}, "filter": {"id": 1} | ||
} | ||
}, | ||
{ | ||
"update": { | ||
"collection": "products", "fields": {"$set": {"quantity": 6357}}, "filter": {"id": 1} | ||
} | ||
} | ||
]' | ||
|
||
# Shutdown the local Tigris | ||
tigris local down | ||
``` | ||
|
||
# License | ||
This software is licensed under the [Apache 2.0](LICENSE). |
Oops, something went wrong.