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

all: [noinit] struct attribute

This commit is contained in:
Alexander Medvednikov
2021-01-08 04:49:13 +01:00
parent 1ce93536d0
commit e3f8d448c1
5 changed files with 14 additions and 7 deletions

View File

@ -33,11 +33,8 @@ pub fn (app &App) index() vweb.Result {
pub fn (mut app App) init_once() {
app.db = sqlite.connect('blog.db') or { panic(err) }
app.db.exec('create table if not exists article (' +
'id integer primary key, ' +
"title text default ''," +
"text text default ''" +
');')
app.db.exec('create table if not exists article (' + 'id integer primary key, ' + "title text default ''," +
"text text default ''" + ');')
}
pub fn (mut app App) init() {
@ -53,8 +50,7 @@ pub fn (mut app App) new_article() vweb.Result {
title := app.form['title']
text := app.form['text']
if title == '' || text == '' {
app.text('Empty text/title')
return vweb.Result{}
return app.text('Empty text/title')
}
article := Article{
title: title