Skip to content

Commit 53ac6fa

Browse files
committed
run v fmt -w ., after the recent [attr] -> @[attr] syntax change
1 parent 66db103 commit 53ac6fa

34 files changed

+142
-142
lines changed

git/libgit.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct C.git_error {
4848
message &char
4949
}
5050

51-
[typedef]
51+
@[typedef]
5252
struct C.git_tree_entry {}
5353

5454
struct C.git_clone_options {
@@ -100,7 +100,7 @@ fn (r Repo) str() string {
100100
return 'Repo{ path:${r.path} }'
101101
}
102102

103-
[params]
103+
@[params]
104104
struct LogParams {
105105
n int
106106
dir string // -C "dir"

src/activity.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import time
44

55
struct Activity {
66
mut:
7-
id int [primary; sql: serial]
7+
id int @[primary; sql: serial]
88
user_id int
99
name string
1010
created_at time.Time

src/admin_routes.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const (
88

99
// TODO move to admin controller
1010

11-
['/admin/settings']
11+
@['/admin/settings']
1212
pub fn (mut app App) admin_settings() vweb.Result {
1313
if !app.is_admin() {
1414
return app.redirect_to_index()
@@ -17,7 +17,7 @@ pub fn (mut app App) admin_settings() vweb.Result {
1717
return $vweb.html()
1818
}
1919

20-
['/admin/settings'; post]
20+
@['/admin/settings'; post]
2121
pub fn (mut app App) handle_admin_update_settings(oauth_client_id string, oauth_client_secret string) vweb.Result {
2222
if !app.is_admin() {
2323
return app.redirect_to_index()
@@ -28,7 +28,7 @@ pub fn (mut app App) handle_admin_update_settings(oauth_client_id string, oauth_
2828
return app.redirect('/admin')
2929
}
3030

31-
['/admin/users/:user'; post]
31+
@['/admin/users/:user'; post]
3232
pub fn (mut app App) handle_admin_edit_user(user_id string) vweb.Result {
3333
if !app.is_admin() {
3434
return app.redirect_to_index()
@@ -43,12 +43,12 @@ pub fn (mut app App) handle_admin_edit_user(user_id string) vweb.Result {
4343
return app.redirect('/admin')
4444
}
4545

46-
['/admin/users']
46+
@['/admin/users']
4747
pub fn (mut app App) admin_users_default() vweb.Result {
4848
return app.admin_users(0)
4949
}
5050

51-
['/admin/users/:page']
51+
@['/admin/users/:page']
5252
pub fn (mut app App) admin_users(page int) vweb.Result {
5353
if !app.is_admin() {
5454
return app.redirect_to_index()
@@ -65,7 +65,7 @@ pub fn (mut app App) admin_users(page int) vweb.Result {
6565
return $vweb.html()
6666
}
6767

68-
['/admin/statistics']
68+
@['/admin/statistics']
6969
pub fn (mut app App) admin_statistics() vweb.Result {
7070
if !app.is_admin() {
7171
return app.redirect_to_index()

src/branch.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import git
55

66
struct Branch {
77
mut:
8-
id int [primary; sql: serial]
9-
repo_id int [unique: 'branch']
10-
name string [unique: 'branch']
8+
id int @[primary; sql: serial]
9+
repo_id int @[unique: 'branch']
10+
name string @[unique: 'branch']
1111
author string // author of latest commit on branch
1212
hash string // hash of latest commit on branch
1313
date int // time of latest commit on branch

src/branch_routes.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module main
33
import vweb
44
import api
55

6-
['/api/v1/:user/:repo_name/branches/count']
6+
@['/api/v1/:user/:repo_name/branches/count']
77
fn (mut app App) handle_branch_count(username string, repo_name string) vweb.Result {
88
has_access := app.has_user_repo_read_access_by_repo_name(app.user.id, username, repo_name)
99

@@ -23,7 +23,7 @@ fn (mut app App) handle_branch_count(username string, repo_name string) vweb.Res
2323
})
2424
}
2525

26-
['/:user/:repo/branches']
26+
@['/:user/:repo/branches']
2727
pub fn (mut app App) branches(username string, repo_name string) vweb.Result {
2828
repo := app.find_repo_by_name_and_username(repo_name, username) or {
2929
return app.json_error('Not found')

src/comment.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import time
88

99
struct Comment {
1010
mut:
11-
id int [primary; sql: serial]
11+
id int @[primary; sql: serial]
1212
author_id int
1313
issue_id int
1414
created_at int
1515
text string
1616
}
1717

18-
['/:username/:repo_name/comments'; post]
18+
@['/:username/:repo_name/comments'; post]
1919
pub fn (mut app App) handle_add_comment(username string, repo_name string) vweb.Result {
2020
app.find_repo_by_name_and_username(repo_name, username) or { return app.not_found() }
2121
text := app.form['text']

src/commit.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import time
66

77
struct Commit {
88
mut:
9-
id int [primary; sql: serial]
9+
id int @[primary; sql: serial]
1010
author_id int
1111
author string
12-
hash string [unique: 'commit']
12+
hash string @[unique: 'commit']
1313
created_at int
14-
repo_id int [unique: 'commit']
15-
branch_id int [unique: 'commit']
14+
repo_id int @[unique: 'commit']
15+
branch_id int @[unique: 'commit']
1616
message string
1717
}
1818

src/commit_routes.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import highlight
55
import time
66
import api
77

8-
['/api/v1/:user/:repo_name/:branch_name/commits/count']
8+
@['/api/v1/:user/:repo_name/:branch_name/commits/count']
99
fn (mut app App) handle_commits_count(username string, repo_name string, branch_name string) vweb.Result {
1010
has_access := app.has_user_repo_read_access_by_repo_name(app.user.id, username, repo_name)
1111

@@ -26,7 +26,7 @@ fn (mut app App) handle_commits_count(username string, repo_name string, branch_
2626
})
2727
}
2828

29-
['/:username/:repo_name/:branch_name/commits/:page']
29+
@['/:username/:repo_name/:branch_name/commits/:page']
3030
pub fn (mut app App) commits(username string, repo_name string, branch_name string, page int) vweb.Result {
3131
repo := app.find_repo_by_name_and_username(repo_name, username) or { return app.not_found() }
3232

@@ -70,7 +70,7 @@ pub fn (mut app App) commits(username string, repo_name string, branch_name stri
7070
return $vweb.html()
7171
}
7272

73-
['/:username/:repo_name/commit/:hash']
73+
@['/:username/:repo_name/commit/:hash']
7474
pub fn (mut app App) commit(username string, repo_name string, hash string) vweb.Result {
7575
repo := app.find_repo_by_name_and_username(repo_name, username) or { return app.not_found() }
7676

src/feed_routes.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ module main
22

33
import vweb
44

5-
['/:username/feed']
5+
@['/:username/feed']
66
pub fn (mut app App) user_feed_default(username string) vweb.Result {
77
return app.user_feed(username, 0)
88
}
99

10-
['/:username/feed/:page']
10+
@['/:username/feed/:page']
1111
pub fn (mut app App) user_feed(username string, page int) vweb.Result {
1212
exists, user := app.check_username(username)
1313

src/file.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import math
55
import os
66

77
struct File {
8-
id int [primary; sql: serial]
9-
repo_id int [unique: 'file']
10-
name string [unique: 'file']
11-
parent_path string [unique: 'file']
8+
id int @[primary; sql: serial]
9+
repo_id int @[unique: 'file']
10+
name string @[unique: 'file']
11+
parent_path string @[unique: 'file']
1212
is_dir bool
13-
branch string [unique: 'file']
13+
branch string @[unique: 'file']
1414
contributors_count int
1515
last_hash string
1616
size int
1717
views_count int
1818
mut:
1919
last_msg string
2020
last_time int
21-
commit Commit [skip]
21+
commit Commit @[skip]
2222
}
2323

2424
fn (f File) url() string {

src/git_routes.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import vweb
66
import git
77
import compress.deflate
88

9-
['/:username/:repo_name/info/refs']
9+
@['/:username/:repo_name/info/refs']
1010
fn (mut app App) handle_git_info(username string, git_repo_name string) vweb.Result {
1111
repo_name := git.remove_git_extension_if_exists(git_repo_name)
1212
user := app.get_user_by_username(username) or { return app.not_found() }
@@ -33,7 +33,7 @@ fn (mut app App) handle_git_info(username string, git_repo_name string) vweb.Res
3333
return app.ok(git_response)
3434
}
3535

36-
['/:user/:repo_name/git-upload-pack'; post]
36+
@['/:user/:repo_name/git-upload-pack'; post]
3737
fn (mut app App) handle_git_upload_pack(username string, git_repo_name string) vweb.Result {
3838
body := app.parse_body()
3939
repo_name := git.remove_git_extension_if_exists(git_repo_name)
@@ -52,7 +52,7 @@ fn (mut app App) handle_git_upload_pack(username string, git_repo_name string) v
5252
return app.ok(git_response)
5353
}
5454

55-
['/:user/:repo_name/git-receive-pack'; post]
55+
@['/:user/:repo_name/git-receive-pack'; post]
5656
fn (mut app App) handle_git_receive_pack(username string, git_repo_name string) vweb.Result {
5757
body := app.parse_body()
5858
repo_name := git.remove_git_extension_if_exists(git_repo_name)

src/github.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ struct OAuthRequest {
1414
}
1515

1616
struct GitHubUser {
17-
username string [json: 'login']
17+
username string @[json: 'login']
1818
name string
1919
email string
20-
avatar string [json: 'avatar_url']
20+
avatar string @[json: 'avatar_url']
2121
}
2222

23-
['/oauth']
23+
@['/oauth']
2424
pub fn (mut app App) handle_oauth() vweb.Result {
2525
code := app.query['code']
2626
state := app.query['state']

src/gitly.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ const (
2424

2525
struct App {
2626
vweb.Context
27-
started_at i64 [vweb_global]
27+
started_at i64 @[vweb_global]
2828
pub mut:
2929
db sqlite.DB
3030
mut:
31-
version string [vweb_global]
32-
logger log.Log [vweb_global]
33-
config config.Config [vweb_global]
31+
version string @[vweb_global]
32+
logger log.Log @[vweb_global]
33+
config config.Config @[vweb_global]
3434
settings Settings
3535
current_path string
3636
page_gen_time string
@@ -136,7 +136,7 @@ pub fn (mut app App) before_request() {
136136
}
137137
}
138138

139-
['/']
139+
@['/']
140140
pub fn (mut app App) index() vweb.Result {
141141
user_count := app.get_users_count() or { 0 }
142142
no_users := user_count == 0

src/issue.v

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ module main
55
import time
66

77
struct Issue {
8-
id int [primary; sql: serial]
8+
id int @[primary; sql: serial]
99
mut:
1010
author_id int
1111
repo_id int
1212
is_pr bool
13-
assigned []int [skip]
14-
labels []int [skip]
13+
assigned []int @[skip]
14+
labels []int @[skip]
1515
comments_count int
1616
title string
1717
text string
1818
created_at int
19-
status IssueStatus [skip]
20-
linked_issues []int [skip]
21-
repo_author string [skip]
22-
repo_name string [skip]
19+
status IssueStatus @[skip]
20+
linked_issues []int @[skip]
21+
repo_author string @[skip]
22+
repo_name string @[skip]
2323
}
2424

2525
enum IssueStatus {

src/issue_routes.v

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct ItemWithUser[T] {
1212
type IssueWithUser = ItemWithUser[Issue]
1313
type CommentWithUser = ItemWithUser[Comment]
1414

15-
['/api/v1/:username/:repo_name/issues/count']
15+
@['/api/v1/:username/:repo_name/issues/count']
1616
fn (mut app App) handle_issues_count(username string, repo_name string) vweb.Result {
1717
has_access := app.has_user_repo_read_access_by_repo_name(app.user.id, username, repo_name)
1818
if !has_access {
@@ -28,7 +28,7 @@ fn (mut app App) handle_issues_count(username string, repo_name string) vweb.Res
2828
})
2929
}
3030

31-
['/:username/:repo_name/issues/new']
31+
@['/:username/:repo_name/issues/new']
3232
pub fn (mut app App) new_issue(username string, repo_name string) vweb.Result {
3333
if !app.logged_in {
3434
return app.not_found()
@@ -37,12 +37,12 @@ pub fn (mut app App) new_issue(username string, repo_name string) vweb.Result {
3737
return $vweb.html()
3838
}
3939

40-
['/:username/issues']
40+
@['/:username/issues']
4141
pub fn (mut app App) handle_get_user_issues(username string) vweb.Result {
4242
return app.user_issues(username, 0)
4343
}
4444

45-
['/:username/:repo_name/issues'; post]
45+
@['/:username/:repo_name/issues'; post]
4646
pub fn (mut app App) handle_add_repo_issue(username string, repo_name string) vweb.Result {
4747
// TODO: use captcha instead of user restrictions
4848
if !app.logged_in || (app.logged_in && app.user.posts_count >= posts_per_day) {
@@ -66,12 +66,12 @@ pub fn (mut app App) handle_add_repo_issue(username string, repo_name string) vw
6666
return app.redirect('/${username}/${repo_name}/issues')
6767
}
6868

69-
['/:username/:repo_name/issues']
69+
@['/:username/:repo_name/issues']
7070
pub fn (mut app App) handle_get_repo_issues(username string, repo_name string) vweb.Result {
7171
return app.issues(username, repo_name, 0)
7272
}
7373

74-
['/:username/:repo_name/issues/:page']
74+
@['/:username/:repo_name/issues/:page']
7575
pub fn (mut app App) issues(username string, repo_name string, page int) vweb.Result {
7676
repo := app.find_repo_by_name_and_username(repo_name, username) or { return app.not_found() }
7777
mut issues_with_users := []IssueWithUser{}
@@ -103,7 +103,7 @@ pub fn (mut app App) issues(username string, repo_name string, page int) vweb.Re
103103
return $vweb.html()
104104
}
105105

106-
['/:username/:repo_name/issue/:id']
106+
@['/:username/:repo_name/issue/:id']
107107
pub fn (mut app App) issue(username string, repo_name string, id string) vweb.Result {
108108
repo := app.find_repo_by_name_and_username(repo_name, username) or { return app.not_found() }
109109
issue := app.find_issue_by_id(id.int()) or { return app.not_found() }
@@ -119,7 +119,7 @@ pub fn (mut app App) issue(username string, repo_name string, id string) vweb.Re
119119
return $vweb.html()
120120
}
121121

122-
['/:username/issues/:page']
122+
@['/:username/issues/:page']
123123
pub fn (mut app App) user_issues(username string, page int) vweb.Result {
124124
if !app.logged_in {
125125
return app.not_found()

src/lang_stats.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module main
33
import vweb
44

55
struct LangStat {
6-
id int [primary; sql: serial]
7-
repo_id int [unique: 'langstat']
8-
name string [unique: 'langstat']
6+
id int @[primary; sql: serial]
7+
repo_id int @[unique: 'langstat']
8+
name string @[unique: 'langstat']
99
lines_count int
1010
pct int // out of 1000
1111
color string

0 commit comments

Comments
 (0)