1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: check (mut f Foo) syntax

This commit is contained in:
yuyi
2020-05-17 19:51:18 +08:00
committed by GitHub
parent b138cadbcb
commit 7f4cf08516
87 changed files with 492 additions and 480 deletions

View File

@ -15,7 +15,7 @@ fn main() {
vweb.run<App>(8080)
}
fn (app mut App) index_text() {
fn (mut app App) index_text() {
app.vweb.text('Hello, world from vweb!')
}
@ -31,7 +31,7 @@ fn (app &App) index() {
$vweb.html()
}
pub fn (app mut App) init() {
pub fn (mut app App) init() {
db := pg.connect(pg.Config{
host: '127.0.0.1'
dbname: 'blog'
@ -40,14 +40,14 @@ pub fn (app mut App) init() {
app.db = db
}
pub fn (app mut App) new() {
pub fn (mut app App) new() {
$vweb.html()
}
pub fn (app mut App) reset() {
pub fn (mut app App) reset() {
}
pub fn (app mut App) new_article() {
pub fn (mut app App) new_article() {
title := app.vweb.form['title']
text := app.vweb.form['text']
if title == '' || text == '' {
@ -64,11 +64,11 @@ pub fn (app mut App) new_article() {
app.vweb.redirect('/article/')
}
pub fn (app mut App) articles() {
pub fn (mut app App) articles() {
articles := app.find_all_articles()
app.vweb.json(json.encode(articles))
}
fn (app mut App) time() {
fn (mut app App) time() {
app.vweb.text(time.now().format())
}