Skip to content

Commit

Permalink
docs: Fixing CI (#201)
Browse files Browse the repository at this point in the history
Fixing the "Verify docs" job and running `v fmt` for the new
version.
  • Loading branch information
elliotchance authored Nov 19, 2024
1 parent 60e7372 commit 4727b8b
Show file tree
Hide file tree
Showing 67 changed files with 406 additions and 396 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:

- name: Verify docs
run: |
export PIP_BREAK_SYSTEM_PACKAGES=1
pip install sphinx sphinx_rtd_theme
cd docs && python3 -m pip install -r requirements.txt && cd -
make clean-docs docs
Expand Down
10 changes: 5 additions & 5 deletions cmd/vsql/bench.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import vsql

fn register_bench_command(mut cmd cli.Command) {
mut bench_cmd := cli.Command{
name: 'bench'
name: 'bench'
description: 'Run benchmark'
execute: bench_command
execute: bench_command
}
bench_cmd.add_flag(cli.Flag{
flag: .string
name: 'file'
abbrev: 'f'
flag: .string
name: 'file'
abbrev: 'f'
description: 'File path that will be deleted and created for the test. You can use :memory: as well (default bench.vsql)'
})
cmd.add_command(bench_cmd)
Expand Down
8 changes: 4 additions & 4 deletions cmd/vsql/cli.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import vsql

fn register_cli_command(mut cmd cli.Command) {
mut cli_cmd := cli.Command{
name: 'cli'
usage: '<file>'
name: 'cli'
usage: '<file>'
required_args: 1
description: 'Run SQL in a vsql file'
execute: cli_command
description: 'Run SQL in a vsql file'
execute: cli_command
}
cmd.add_command(cli_cmd)
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/vsql/in.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import vsql

fn register_in_command(mut cmd cli.Command) {
mut in_cmd := cli.Command{
name: 'in'
usage: '<file>'
name: 'in'
usage: '<file>'
required_args: 1
description: 'Import schema and data'
execute: in_command
description: 'Import schema and data'
execute: in_command
}

in_cmd.add_flag(cli.Flag{
flag: .bool
name: 'continue-on-error'
flag: .bool
name: 'continue-on-error'
description: 'Continue when errors occur'
})

in_cmd.add_flag(cli.Flag{
flag: .bool
name: 'verbose'
abbrev: 'v'
flag: .bool
name: 'verbose'
abbrev: 'v'
description: 'Show result of each command'
})

Expand Down
4 changes: 2 additions & 2 deletions cmd/vsql/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import os

fn main() {
mut cmd := cli.Command{
name: 'vsql'
name: 'vsql'
description: 'vsql is a single-file or PostgeSQL-compatible SQL database written in V.\nhttps://github.com/elliotchance/vsql'
execute: unknown_command
execute: unknown_command
}

register_bench_command(mut cmd)
Expand Down
12 changes: 6 additions & 6 deletions cmd/vsql/out.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import vsql

fn register_out_command(mut cmd cli.Command) {
mut out_cmd := cli.Command{
name: 'out'
usage: '<file>'
name: 'out'
usage: '<file>'
required_args: 1
description: 'Export schema and data'
execute: out_command
description: 'Export schema and data'
execute: out_command
}

out_cmd.add_flag(cli.Flag{
flag: .bool
name: 'create-public-schema'
flag: .bool
name: 'create-public-schema'
description: 'Include "CREATE SCHEMA PUBLIC"'
})

Expand Down
22 changes: 11 additions & 11 deletions cmd/vsql/server.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import vsql

fn register_server_command(mut cmd cli.Command) {
mut server_cmd := cli.Command{
name: 'server'
description: 'Run as a server for PostgreSQL clients'
usage: '<file>'
name: 'server'
description: 'Run as a server for PostgreSQL clients'
usage: '<file>'
required_args: 1
execute: server_command
execute: server_command
}
server_cmd.add_flag(cli.Flag{
flag: .bool
name: 'verbose'
abbrev: 'v'
flag: .bool
name: 'verbose'
abbrev: 'v'
description: 'Verbose (show all messages in and out of the server)'
})
server_cmd.add_flag(cli.Flag{
flag: .int
name: 'port'
abbrev: 'p'
flag: .int
name: 'port'
abbrev: 'p'
description: 'Port number (default 3210)'
})
cmd.add_command(server_cmd)
Expand All @@ -36,7 +36,7 @@ fn server_command(cmd cli.Command) ! {

mut server := vsql.new_server(vsql.ServerOptions{
db_file: cmd.args[0]
port: port
port: port
verbose: cmd.flags.get_bool('verbose') or { false }
})

Expand Down
4 changes: 2 additions & 2 deletions cmd/vsql/version.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import cli

fn register_version_command(mut cmd cli.Command) {
mut version_cmd := cli.Command{
name: 'version'
name: 'version'
description: 'Show version'
execute: version_command
execute: version_command
}
cmd.add_command(version_cmd)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx==5.0.0
sphinx_rtd_theme==1.0.0
sphinx==8.0.0
sphinx_rtd_theme==3.0.2
readthedocs-sphinx-search==0.1.1
10 changes: 5 additions & 5 deletions tests/double-precision.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ VALUES 53.7e0 - CAST(1.23 AS DOUBLE PRECISION);

/* types */
VALUES CAST(-2000000000.1 AS DOUBLE PRECISION) - 500000000.7e0;
-- COL1: -0.25000000008e+10 (DOUBLE PRECISION)
-- COL1: -2.5000000008e+09 (DOUBLE PRECISION)

/* types */
VALUES -500000000.7e0 - CAST(2000000000.1 AS DOUBLE PRECISION);
-- COL1: -0.25000000008e+10 (DOUBLE PRECISION)
-- COL1: -2.5000000008e+09 (DOUBLE PRECISION)

/* types */
VALUES CAST(12.3 AS DOUBLE PRECISION) * 53.7e0;
Expand All @@ -93,11 +93,11 @@ VALUES -53.7e0 * CAST(12.3 AS DOUBLE PRECISION);

/* types */
VALUES CAST(-300000.1 AS DOUBLE PRECISION) * 200000.7e0;
-- COL1: -6.000023000007e+10 (DOUBLE PRECISION)
-- COL1: -6.00002300001e+10 (DOUBLE PRECISION)

/* types */
VALUES -300000.7e0 * CAST(200000.1 AS DOUBLE PRECISION);
-- COL1: -6.000017000007e+10 (DOUBLE PRECISION)
-- COL1: -6.00001700001e+10 (DOUBLE PRECISION)

/* types */
VALUES CAST(1.23 AS DOUBLE PRECISION) / 53.7e0;
Expand Down Expand Up @@ -128,5 +128,5 @@ SELECT * FROM foo;
SELECT CAST(x AS BIGINT) FROM foo;
-- msg: CREATE TABLE 1
-- msg: INSERT 1
-- X: 0.1234567891235e+27
-- X: 1.23456789123e+26
-- error 22003: numeric value out of range
4 changes: 2 additions & 2 deletions tests/real.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ VALUES CAST(-53.7 AS REAL) * CAST(12.3 AS REAL);

/* types */
VALUES CAST(-300000.1 AS REAL) * CAST(200000.7 AS REAL);
-- COL1: -6.000023e+10 (REAL)
-- COL1: -6.00002e+10 (REAL)

/* types */
VALUES CAST(-300000.7 AS REAL) * CAST(200000.1 AS REAL);
-- COL1: -0.6000017e+11 (REAL)
-- COL1: -6.00002e+10 (REAL)

/* types */
VALUES CAST(1.23 AS REAL) / CAST(53.7 AS REAL);
Expand Down
8 changes: 4 additions & 4 deletions vsql/bench.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ pub mut:
pub fn new_benchmark(conn &Connection) Benchmark {
return Benchmark{
account_rows: 100000
teller_rows: 10
branch_rows: 1
run_for: time.minute
conn: conn
teller_rows: 10
branch_rows: 1
run_for: time.minute
conn: conn
}
}

Expand Down
6 changes: 3 additions & 3 deletions vsql/btree.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mut:

fn new_btree(pager Pager, page_size int) &Btree {
return &Btree{
pager: pager
pager: pager
page_size: page_size
}
}
Expand Down Expand Up @@ -383,8 +383,8 @@ fn (mut p Btree) split_page(path []int, page Page, obj PageObject, kind u8) ! {
fn (p Btree) new_range_iterator(min []u8, max []u8) PageIterator {
return PageIterator{
btree: p
min: min
max: max
min: min
max: max
}
}

Expand Down
2 changes: 1 addition & 1 deletion vsql/btree_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn test_btree_test() ! {
page_size := 256
file_name := 'btree.vsql'

for tt in 0 .. vsql.times {
for tt in 0 .. times {
for size := 1; size <= 1000; size *= 10 {
for blob_size in blob_sizes {
if os.exists(file_name) {
Expand Down
4 changes: 2 additions & 2 deletions vsql/compiler.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ struct CompileResult {

fn (c CompileResult) with_agg(contains_agg bool) CompileResult {
return CompileResult{
run: c.run
typ: c.typ
run: c.run
typ: c.typ
contains_agg: contains_agg
}
}
31 changes: 16 additions & 15 deletions vsql/connection.v
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ fn open_connection(path string, options ConnectionOptions) !&Connection {
catalog_name := catalog_name_from_path(path)

mut conn := &Connection{
query_cache: options.query_cache
query_cache: options.query_cache
current_catalog: catalog_name
current_schema: vsql.default_schema_name
now: default_now
current_schema: default_schema_name
now: default_now
}

register_builtin_funcs(mut conn)!
Expand All @@ -140,9 +140,9 @@ pub fn (mut conn Connection) add_catalog(catalog_name string, path string, optio

catalog := &CatalogConnection{
catalog_name: catalog_name
path: path
storage: new_storage(btree)
options: options
path: path
storage: new_storage(btree)
options: options
}

conn.catalogs[catalog_name] = catalog
Expand Down Expand Up @@ -350,9 +350,9 @@ pub fn (mut conn Connection) register_virtual_table(create_table string, data Vi
mut table_name := conn.resolve_schema_identifier(stmt.table_name)!

conn.catalogs[conn.current_catalog].virtual_tables[table_name.storage_id()] = VirtualTable{
create_table_sql: create_table
create_table_sql: create_table
create_table_stmt: stmt
data: data
data: data
}

return
Expand Down Expand Up @@ -416,19 +416,20 @@ pub fn (mut conn CatalogConnection) schema_tables(schema string) ![]Table {
// canonical (fully qualified) form.
fn (conn Connection) resolve_identifier(identifier Identifier) Identifier {
return Identifier{
custom_id: identifier.custom_id
custom_typ: identifier.custom_typ
catalog_name: if identifier.catalog_name == '' && !identifier.entity_name.starts_with('$') {
custom_id: identifier.custom_id
custom_typ: identifier.custom_typ
catalog_name: if identifier.catalog_name == ''
&& !identifier.entity_name.starts_with('$') {
conn.current_catalog
} else {
identifier.catalog_name
}
schema_name: if identifier.schema_name == '' && !identifier.entity_name.starts_with('$') {
schema_name: if identifier.schema_name == '' && !identifier.entity_name.starts_with('$') {
conn.current_schema
} else {
identifier.schema_name
}
entity_name: identifier.entity_name
entity_name: identifier.entity_name
sub_entity_name: identifier.sub_entity_name
}
}
Expand Down Expand Up @@ -518,8 +519,8 @@ pub mut:
pub fn default_connection_options() ConnectionOptions {
return ConnectionOptions{
query_cache: new_query_cache()
page_size: 4096
mutex: sync.new_rwmutex()
page_size: 4096
mutex: sync.new_rwmutex()
}
}

Expand Down
4 changes: 2 additions & 2 deletions vsql/connection_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ fn test_concurrent_writes() ! {
waits << spawn fn (file_name string, i int, options ConnectionOptions) {
mut db := open_database(file_name, options) or { panic(err) }
for j in 0 .. 100 {
if vsql.verbose {
if verbose {
println('${i}.${j}: INSERT start')
}
db.query('INSERT INTO foo (x) VALUES (1)') or { panic(err) }
if vsql.verbose {
if verbose {
println('${i}.${j}: INSERT done')
}
}
Expand Down
16 changes: 8 additions & 8 deletions vsql/earley.v
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ fn new_earley_state(name string, production &EarleyProduction, dot_index int, st
}

return &EarleyState{
name: name
production: production
name: name
production: production
start_column: start_column
dot_index: dot_index
rules: rules
end_column: unsafe { 0 }
dot_index: dot_index
rules: rules
end_column: unsafe { 0 }
}
}

Expand Down Expand Up @@ -136,9 +136,9 @@ mut:

fn new_earley_column(index int, token string, value string) &EarleyColumn {
return &EarleyColumn{
index: index
token: token
value: value
index: index
token: token
value: value
unique: &Set{}
}
}
Expand Down
Loading

0 comments on commit 4727b8b

Please sign in to comment.