Skip to content

Commit 9772649

Browse files
committed
usecache: fix duplicates; doc: minor fixes
1 parent d97ed77 commit 9772649

5 files changed

Lines changed: 26 additions & 26 deletions

File tree

‎doc/docs.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5475,7 +5475,7 @@ println('number of all customers: ${nr_customers}')
54755475
54765476
// V's syntax can be used to build queries:
54775477
uk_customers := sql db {
5478-
select from Customer where country == 'uk' && nr_orders > 0
5478+
select from Customer where country == 'uk' && nr_orders > 0 order by id desc limit 10
54795479
}!
54805480
println('We found a total of ${uk_customers.len} customers matching the query.')
54815481
for c in uk_customers {

‎examples/tetris/README.md‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<img src='https://raw.githubusercontent.com/vlang/v/master/examples/tetris/screenshot.png' width=300>
22

3-
### Dependencies (Ubuntu)
3+
### Dependencies (Ubuntu/Debian)
44
```sh
5-
sudo apt install libx11-dev
6-
sudo apt install libxi-dev
7-
sudo apt install libxcursor-dev
8-
sudo apt install libxrandr-dev
9-
sudo apt install libgl-dev
5+
sudo apt install -y libx11-dev libxi-dev libxcursor-dev libxrandr-dev libgl-dev
106
```
117

128
## Compiling to JS

‎vlib/orm/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct Foo {
3232
- `[sql: 'name']` sets a custom column name for the field
3333
- `[sql_type: 'SQL TYPE']` explicitly sets the type in SQL
3434
- `[default: 'raw_sql']` inserts `raw_sql` verbatim in a "DEFAULT" clause when
35-
creating a new table, allowing for SQL functions like `CURRENT_TIME`. For raw strings,
35+
creating a new table, allowing for SQL functions like `CURRENT_TIME`. For raw strings,
3636
surround `raw_sql` with backticks (\`).
3737

3838
- `[fkey: 'parent_id']` sets foreign key for an field which holds an array
@@ -166,7 +166,7 @@ result := sql db {
166166

167167
```v ignore
168168
result := sql db {
169-
select from Foo where id > 1 order by id
169+
select from Foo where id > 1 order by id desc
170170
}!
171171
```
172172

@@ -198,8 +198,8 @@ sql db {
198198
### time.Time Fields
199199

200200
It's definitely useful to cast a field as `time.Time` so you can use V's built-in time functions;
201-
however, this is handled a bit differently than expected in the ORM. `time.Time` fields are
202-
created as integer columns in the database. Because of this, the usual time functions
201+
however, this is handled a bit differently than expected in the ORM. `time.Time` fields are
202+
created as integer columns in the database. Because of this, the usual time functions
203203
(`current_timestamp`, `NOW()`, etc) in SQL do not work as defaults.
204204

205205
## Example

‎vlib/v/gen/c/cgen.v‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,23 +1224,26 @@ pub fn (mut g Gen) write_typeof_functions() {
12241224
g.writeln('\tif (sidx == _${sym.cname}_${sub_sym.cname}_index) return "${util.strip_main_name(sub_sym.name)}";')
12251225
}
12261226
g.writeln2('\treturn "unknown ${util.strip_main_name(sym.name)}";', '}')
1227-
g.definitions.writeln('u32 v_typeof_interface_idx_${sym.cname}(u32 sidx);')
1228-
g.writeln2('', 'u32 v_typeof_interface_idx_${sym.cname}(u32 sidx) {')
1229-
if g.pref.parallel_cc {
1230-
g.extern_out.writeln('extern u32 v_typeof_interface_idx_${sym.cname}(u32 sidx);')
1231-
}
1232-
for t in inter_info.types {
1233-
sub_sym := g.table.sym(ast.mktyp(t))
1234-
if sub_sym.info is ast.Struct && sub_sym.info.is_unresolved_generic() {
1235-
continue
1236-
}
1237-
if g.pref.skip_unused && sub_sym.kind == .struct
1238-
&& sub_sym.idx !in g.table.used_features.used_syms {
1239-
continue
1227+
// Avoid duplicate symbol '_v_typeof_interface_idx_IError' when using -usecache
1228+
if g.pref.build_mode != .build_module {
1229+
g.definitions.writeln('u32 v_typeof_interface_idx_${sym.cname}(u32 sidx);')
1230+
g.writeln2('', 'u32 v_typeof_interface_idx_${sym.cname}(u32 sidx) {')
1231+
if g.pref.parallel_cc {
1232+
g.extern_out.writeln('extern u32 v_typeof_interface_idx_${sym.cname}(u32 sidx);')
1233+
}
1234+
for t in inter_info.types {
1235+
sub_sym := g.table.sym(ast.mktyp(t))
1236+
if sub_sym.info is ast.Struct && sub_sym.info.is_unresolved_generic() {
1237+
continue
1238+
}
1239+
if g.pref.skip_unused && sub_sym.kind == .struct
1240+
&& sub_sym.idx !in g.table.used_features.used_syms {
1241+
continue
1242+
}
1243+
g.writeln('\tif (sidx == _${sym.cname}_${sub_sym.cname}_index) return ${u32(t.set_nr_muls(0))};')
12401244
}
1241-
g.writeln('\tif (sidx == _${sym.cname}_${sub_sym.cname}_index) return ${u32(t.set_nr_muls(0))};')
1245+
g.writeln2('\treturn ${u32(ityp)};', '}')
12421246
}
1243-
g.writeln2('\treturn ${u32(ityp)};', '}')
12441247
}
12451248
}
12461249
g.writeln2('// << typeof() support for sum types', '')

‎vlib/veb/auth/auth.v‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub:
2525
}
2626

2727
pub fn new[T](db T) Auth[T] {
28+
println('creating table Token')
2829
set_rand_crypto_safe_seed()
2930
sql db {
3031
create table Token

0 commit comments

Comments
 (0)