Skip to content

Commit 47fb7cf

Browse files
committed
Move the go sdk to a separate repo so we can use a simpler module path
0 parents  commit 47fb7cf

33 files changed

Lines changed: 6791 additions & 0 deletions

β€Ž.gitignoreβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
cli/.DS_Store
3+
.DS_Store

β€ŽMakefileβ€Ž

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
GOPATH = $(shell go env GOPATH)
2+
3+
# Test SDK
4+
.PHONY: test
5+
test:
6+
cd sdk/test; go test -v
7+
8+
# GO SDK
9+
.PHONY: sdk
10+
sdk: sdk/*.go
11+
cd sdk; go build
12+
13+
# CLI App
14+
$(GOPATH)/bin/sqlc: sdk/*.go cli/sqlc.go
15+
cd cli; go build -o $(GOPATH)/bin/sqlc
16+
17+
cli: $(GOPATH)/bin/sqlc
18+
19+
github:
20+
open https://github.com/sqlitecloud/sdk
21+
22+
diff:
23+
git difftool
24+
25+
26+
# gosec
27+
gosec:
28+
ifeq ($(wildcard $(GOPATH)/bin/gosec),)
29+
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin
30+
endif
31+
32+
checksec: gosec sdk/*.go cli/*.go
33+
cd sdk; $(GOPATH)/bin/gosec -exclude=G304 .
34+
cd cli; $(GOPATH)/bin/gosec -exclude=G304,G302 .
35+
36+
37+
# Documentation
38+
godoc:
39+
ifeq ($(wildcard $(GOPATH)/bin/godoc),)
40+
go install golang.org/x/tools/cmd/godoc
41+
endif
42+
43+
doc: godoc
44+
ifeq ($(wildcard ./src),)
45+
ln -s . src
46+
endif
47+
@echo "Hit CRTL-C to stop the documentation server..."
48+
@( sleep 1 && open http://localhost:6060/pkg/sdk/ ) &
49+
@$(GOPATH)/bin/godoc -http=:6060 -index -play -goroot ./
50+
51+
clean:
52+
rm -rf $(GOPATH)/bin/sqlc*
53+
54+
all: sdk cli test_dev1

β€ŽREADME.mdβ€Ž

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SQLite Cloud GO Client
2+
3+
## Get started
4+
5+
### Fetching the code:
6+
```console
7+
cd
8+
mkdir test
9+
cd test
10+
git clone https://github.com/sqlitecloud/sdk
11+
User: <github user name>
12+
Password: <access-token or password>
13+
14+
```
15+
16+
### Setting up the development environment
17+
```console
18+
go env -w GO111MODULE=on
19+
export GOPATH=
20+
echo $GOPATH
21+
```
22+
23+
### Run the test for the SDK
24+
If you want to run the Test programs: `make test`
25+
26+
### Building the CLI App
27+
To build the CLI App, you have to enter: `make cli`
28+
29+
### Build all at the same time:
30+
If you want to do all at the same time: `make all`
31+
32+
## Documentation
33+
If you want to see the Documentation: `make doc` - Warning: A browser window will open and display the documentation to you. The Documentation is updated live while coding. To stop the live mode, press CRTL-C on the command line.
34+
35+
## Development helpers
36+
- Check files with gosec: `make checksec`
37+
- Open the repo in github: `make github`.
38+
- See changes: `make diff`
39+
- Clean dependencies and precompiled code: `make clean`
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
βœ… = Implemented, directly or indrectly available
2+
πŸ€” = Not Implemented / Maybe later?
3+
πŸ‘Ž = Decided agains implementation, not usefull
4+
❌ = Does not apply / will never be implemented
5+
6+
SQLite3
7+
8+
πŸ€” -A ARGS... run ".archive ARGS" and exit
9+
❌ -append append the database to the end of the file
10+
πŸ‘Ž -ascii set output mode to 'ascii'
11+
βœ… -bail stop after hitting an error
12+
πŸ€” -batch force batch I/O
13+
βœ… -box set output mode to 'box'
14+
βœ… -column set output mode to 'column'
15+
βœ… -cmd COMMAND run "COMMAND" before reading stdin
16+
βœ… -csv set output mode to 'csv'
17+
❌ -deserialize open the database using sqlite3_deserialize()
18+
βœ… -echo print commands before execution
19+
βœ… -init FILENAME read/process named file
20+
βœ… -[no]header turn headers on or off
21+
βœ… -help show this message
22+
βœ… -html set output mode to HTML
23+
πŸ‘Ž -interactive force interactive I/O
24+
βœ… -json set output mode to 'json'
25+
βœ… -line set output mode to 'line'
26+
βœ… -list set output mode to 'list'
27+
❌ -lookaside SIZE N use N entries of SZ bytes for lookaside memory
28+
βœ… -markdown set output mode to 'markdown'
29+
❌ -maxsize N maximum size for a --deserialize database
30+
❌ -memtrace trace all memory allocations and deallocations
31+
❌ -mmap N default mmap size set to N
32+
βœ… -newline SEP set output row separator. Default: '\n'
33+
❌ -nofollow refuse to open symbolic links to database files
34+
βœ… -nullvalue TEXT set text string for NULL values. Default ''
35+
❌ -pagecache SIZE N use N slots of SZ bytes each for page cache memory
36+
βœ… -quote set output mode to 'quote'
37+
❌ -readonly open the database read-only
38+
βœ… -separator SEP set output column separator. Default: '|'
39+
πŸ‘Ž -stats print memory stats before each finalize
40+
βœ… -table set output mode to 'table'
41+
βœ… -tabs set output mode to 'tabs'
42+
βœ… -version show SQLite version
43+
❌ -vfs NAME use NAME as the default VFS
44+
❌ -zip open the file as a ZIP Archive
45+
46+
47+
PostgreSQL
48+
49+
βœ… -c, --command=COMMAND run only single command (SQL or internal) and exit
50+
βœ… -d, --dbname=DBNAME database name to connect to (default: "ubuntu")
51+
βœ… -f, --file=FILENAME execute commands from file, then exit
52+
βœ… -l, --list list available databases, then exit
53+
πŸ€” -v, --set=, --variable=NAME=VALUE
54+
πŸ€” set psql variable NAME to VALUE
55+
πŸ€” (e.g., -v ON_ERROR_STOP=1)
56+
βœ… -V, --version output version information, then exit
57+
πŸ‘Ž -X, --no-psqlrc do not read startup file (~/.psqlrc)
58+
πŸ‘Ž -1 ("one"), --single-transaction
59+
πŸ‘Ž execute as a single transaction (if non-interactive)
60+
βœ… -?, --help[=options] show this help, then exit
61+
πŸ‘Ž --help=commands list backslash commands, then exit
62+
πŸ‘Ž --help=variables list special variables, then exit
63+
64+
Input and output options:
65+
πŸ‘Ž -a, --echo-all echo all input from script
66+
πŸ‘Ž -b, --echo-errors echo failed commands
67+
βœ… -e, --echo-queries echo commands sent to server
68+
πŸ‘Ž -E, --echo-hidden display queries that internal commands generate
69+
πŸ€” -L, --log-file=FILENAME send session log to file
70+
πŸ€” -E, --echo-hidden display queries that internal commands generate
71+
πŸ€” -n, --no-readline disable enhanced command line editing (readline)
72+
βœ… -o, --output=FILENAME send query results to file (or |pipe)
73+
βœ… -q, --quiet run quietly (no messages, only query output)
74+
πŸ€” -s, --single-step single-step mode (confirm each query)
75+
❌ -S, --single-line single-line mode (end of line terminates SQL command)
76+
77+
Output format options:
78+
πŸ€” -A, --no-align unaligned table output mode
79+
βœ… -F, --field-separator=STRING
80+
βœ… field separator for unaligned output (default: "|")
81+
βœ… -H, --html HTML table output mode
82+
πŸ€” -P, --pset=VAR[=ARG] set printing option VAR to ARG (see \pset command)
83+
βœ… -R, --record-separator=STRING
84+
βœ… record separator for unaligned output (default: newline)
85+
βœ… -t, --tuples-only print rows only
86+
πŸ€” -T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)
87+
πŸ€” -x, --expanded turn on expanded table output
88+
πŸ‘Ž -z, --field-separator-zero
89+
πŸ‘Ž set field separator for unaligned output to zero byte
90+
πŸ‘Ž -0, --record-separator-zero
91+
πŸ‘Ž set record separator for unaligned output to zero byte
92+
93+
Connection options:
94+
βœ… -h, --host=HOSTNAME database server host or socket directory (default: "/var/run/postgresql")
95+
βœ… -p, --port=PORT database server port (default: "5432")
96+
βœ… -U, --username=USERNAME database user name (default: "ubuntu")
97+
πŸ€” -w, --no-password never prompt for password
98+
βœ… -W, --password force password prompt (should happen automatically)
99+
100+
101+
mysql
102+
103+
Usage: mysql [OPTIONS] [database]
104+
βœ… -?, --help Display this help and exit.
105+
πŸ‘Ž -I, --help Synonym for -?
106+
βœ… --auto-rehash Enable automatic rehashing. One doesn't need to use
107+
βœ… 'rehash' to get table and field completion, but startup
108+
βœ… and reconnecting may take a longer time. Disable with
109+
βœ… --disable-auto-rehash.
110+
πŸ€” -A, --no-auto-rehash
111+
πŸ€” No automatic rehashing. One has to use 'rehash' to get
112+
πŸ€” table and field completion. This gives a quicker start of
113+
πŸ€” mysql and disables rehashing on reconnect. WARNING:
114+
πŸ€” options deprecated; use --disable-auto-rehash instead.
115+
βœ… -B, --batch Don't use history file. Disable interactive behavior.
116+
βœ… (Enables --silent)
117+
πŸ‘Ž --character-sets-dir=name
118+
πŸ‘Ž Directory where character sets are.
119+
πŸ‘Ž --default-character-set=name
120+
πŸ‘Ž Set the default character set.
121+
βœ… -C, --compress Use compression in server/client protocol.
122+
πŸ€” -#, --debug[=#] This is a non-debug version. Catch this and exit
123+
βœ… -D, --database=name Database to use.
124+
βœ… --delimiter=name Delimiter to be used.
125+
βœ… -e, --execute=name Execute command and quit. (Disables --force and history
126+
βœ… file)
127+
βœ… -E, --vertical Print the output of a query (rows) vertically.
128+
πŸ€” -f, --force Continue even if we get an sql error.
129+
βœ… -G, --named-commands
130+
βœ… Enable named commands. Named commands mean this program's
131+
βœ… internal commands; see mysql> help . When enabled, the
132+
βœ… named commands can be used from any line of the query,
133+
βœ… otherwise only from the first line, before an enter.
134+
βœ… Disable with --disable-named-commands. This option is
135+
βœ… disabled by default.
136+
πŸ‘Ž -g, --no-named-commands
137+
πŸ‘Ž Named commands are disabled. Use \* form only, or use
138+
πŸ‘Ž named commands only in the beginning of a line ending
139+
πŸ‘Ž with a semicolon (;) Since version 10.9 the client now
140+
πŸ‘Ž starts with this option ENABLED by default! Disable with
141+
πŸ‘Ž '-G'. Long format commands still work from the first
142+
πŸ‘Ž line. WARNING: option deprecated; use
143+
πŸ‘Ž --disable-named-commands instead.
144+
πŸ‘Ž -i, --ignore-spaces Ignore space after function names.
145+
πŸ‘Ž --local-infile Enable/disable LOAD DATA LOCAL INFILE.
146+
πŸ‘Ž -b, --no-beep Turn off beep on error.
147+
βœ… -h, --host=name Connect to host.
148+
βœ… -H, --html Produce HTML output.
149+
βœ… -X, --xml Produce XML output
150+
❌ --line-numbers Write line numbers for errors.
151+
❌ -L, --skip-line-numbers
152+
❌ Don't write line number for errors. WARNING: -L is
153+
❌ deprecated, use long version of this option instead.
154+
βœ… -n, --unbuffered Flush buffer after each query.
155+
βœ… --column-names Write column names in results.
156+
βœ… -N, --skip-column-names
157+
βœ… Don't write column names in results. WARNING: -N is
158+
βœ… deprecated, use long version of this options instead.
159+
πŸ€” -O, --set-variable=name
160+
πŸ€” Change the value of a variable. Please note that this
161+
πŸ€” option is deprecated; you can set variables directly with
162+
πŸ€” --variable-name=value.
163+
πŸ‘Ž --sigint-ignore Ignore SIGINT (CTRL-C)
164+
❌ -o, --one-database Only update the default database. This is useful for
165+
❌ skipping updates to other database in the update log.
166+
πŸ‘Ž --pager[=name] Pager to use to display results. If you don't supply an
167+
πŸ‘Ž option the default pager is taken from your ENV variable
168+
πŸ‘Ž PAGER. Valid pagers are less, more, cat [> filename],
169+
πŸ‘Ž etc. See interactive help (\h) also. This option does not
170+
πŸ‘Ž work in batch mode. Disable with --disable-pager. This
171+
πŸ‘Ž option is disabled by default.
172+
πŸ‘Ž --no-pager Disable pager and print to stdout. See interactive help
173+
πŸ‘Ž (\h) also. WARNING: option deprecated; use
174+
πŸ‘Ž --disable-pager instead.
175+
βœ… -p, --password[=name]
176+
βœ… Password to use when connecting to server. If password is
177+
βœ… not given it's asked from the tty.
178+
βœ… -P, --port=# Port number to use for connection.
179+
πŸ€” --prompt=name Set the mysql prompt to this value.
180+
❌ --protocol=name The protocol of connection (tcp,socket,pipe,memory).
181+
πŸ€” -q, --quick Don't cache result, print it row by row. This may slow
182+
πŸ€” down the server if the output is suspended. Doesn't use
183+
πŸ€” history file.
184+
πŸ€” -r, --raw Write fields without conversion. Used with --batch.
185+
πŸ€” --reconnect Reconnect if the connection is lost. Disable with
186+
πŸ€” --disable-reconnect. This option is enabled by default.
187+
βœ… -s, --silent Be more silent. Print results with a tab as separator,
188+
βœ… each row on new line.
189+
❌ -S, --socket=name Socket file to use for connection.
190+
πŸ€” --ssl Enable SSL for connection (automatically enabled with
191+
πŸ€” other flags). Disable with --skip-ssl.
192+
πŸ€” --ssl-ca=name CA file in PEM format (check OpenSSL docs, implies
193+
πŸ€” --ssl).
194+
πŸ€” --ssl-capath=name CA directory (check OpenSSL docs, implies --ssl).
195+
πŸ€” --ssl-cert=name X509 cert in PEM format (implies --ssl).
196+
πŸ€” --ssl-cipher=name SSL cipher to use (implies --ssl).
197+
πŸ€” --ssl-key=name X509 key in PEM format (implies --ssl).
198+
πŸ€” --ssl-verify-server-cert
199+
πŸ€” Verify server's "Common Name" in its cert against
200+
πŸ€” hostname used when connecting. This option is disabled by
201+
πŸ€” default.
202+
βœ… -t, --table Output in table format.
203+
πŸ‘Ž -T, --debug-info Print some debug info at exit.
204+
πŸ‘Ž --tee=name Append everything into outfile. See interactive help (\h)
205+
πŸ‘Ž also. Does not work in batch mode. Disable with
206+
πŸ‘Ž --disable-tee. This option is disabled by default.
207+
πŸ‘Ž --no-tee Disable outfile. See interactive help (\h) also. WARNING:
208+
πŸ‘Ž option deprecated; use --disable-tee instead
209+
βœ… -u, --user=name User for login if not current user.
210+
❌ -U, --safe-updates Only allow UPDATE and DELETE that uses keys.
211+
πŸ‘Ž -U, --i-am-a-dummy Synonym for option --safe-updates, -U.
212+
πŸ€” -v, --verbose Write more. (-v -v -v gives the table output format).
213+
βœ… -V, --version Output version information and exit.
214+
πŸ€” -w, --wait Wait and retry if connection is down.
215+
βœ… --connect_timeout=# Number of seconds before connection timeout.
216+
πŸ€” --max_allowed_packet=#
217+
πŸ€” Max packet length to send to, or receive from server
218+
πŸ€” --net_buffer_length=#
219+
πŸ€” Buffer for TCP/IP and socket communication
220+
πŸ€” --select_limit=# Automatic limit for SELECT when using --safe-updates
221+
❌ --max_join_size=# Automatic limit for rows in a join when using
222+
❌ --safe-updates
223+
❌ --secure-auth Refuse client connecting to server if it uses old
224+
❌ (pre-4.1.1) protocol
225+
πŸ€” --show-warnings Show warnings after every statement.

0 commit comments

Comments
Β (0)