diff --git a/src/dbms/dbms.v b/src/dbms/dbms.v index 686bb52..e5676ab 100644 --- a/src/dbms/dbms.v +++ b/src/dbms/dbms.v @@ -80,7 +80,7 @@ pub fn init(db_path string) !VieterDb { } } -// row_into converts an sqlite.Row into a given type T by parsing each field +// row_into[T] converts an sqlite.Row into a given type T by parsing each field // from a string according to its type. pub fn row_into[T](row sqlite.Row) T { mut i := 0 diff --git a/src/models/models.v b/src/models/models.v index 9111286..1ed0da8 100644 --- a/src/models/models.v +++ b/src/models/models.v @@ -2,7 +2,7 @@ module models import time -// from_params creates a new instance of T from the given map by parsing all +// from_params[T] creates a new instance of T from the given map by parsing all // of its fields from the map. pub fn from_params[T](params map[string]string) ?T { mut o := T{} @@ -12,7 +12,7 @@ pub fn from_params[T](params map[string]string) ?T { return o } -// patch_from_params updates the given T object with the params defined in +// patch_from_params[T] updates the given T object with the params defined in // the map. pub fn patch_from_params[T](mut o T, params map[string]string) ? { $for field in T.fields { @@ -36,7 +36,7 @@ pub fn patch_from_params[T](mut o T, params map[string]string) ? { } } -// params_from converts a given T struct into a map of strings. +// params_from[T] converts a given T struct into a map of strings. pub fn params_from[T](o &T) map[string]string { mut out := map[string]string{} diff --git a/src/util/stream.v b/src/util/stream.v index ec4c971..4b362fc 100644 --- a/src/util/stream.v +++ b/src/util/stream.v @@ -48,7 +48,7 @@ pub fn reader_to_file(mut reader io.BufferedReader, length int, path string) ! { } } -// match_array_in_array returns how many elements of a2 overlap with a1. For +// match_array_in_array[T] returns how many elements of a2 overlap with a1. For // example, if a1 = "abcd" & a2 = "cd", the result will be 2. If the match is // not at the end of a1, the result is 0. pub fn match_array_in_array[T](a1 []T, a2 []T) int { diff --git a/src/web/response/response.v b/src/web/response/response.v index f736f77..c1475ff 100644 --- a/src/web/response/response.v +++ b/src/web/response/response.v @@ -15,7 +15,7 @@ pub fn new_response(message string) Response[string] { } } -// new_data_response constructs a new Response object with the given data +// new_data_response[T] constructs a new Response object with the given data // & an empty message field. pub fn new_data_response[T](data T) Response[T] { return Response[T]{ @@ -24,7 +24,7 @@ pub fn new_data_response[T](data T) Response[T] { } } -// new_full_response constructs a new Response object with the given +// new_full_response[T] constructs a new Response object with the given // message & data. pub fn new_full_response[T](message string, data T) Response[T] { return Response[T]{ diff --git a/src/web/web.v b/src/web/web.v index 300ce32..54801f7 100644 --- a/src/web/web.v +++ b/src/web/web.v @@ -157,7 +157,7 @@ pub fn (mut ctx Context) body(status http.Status, content_type string, body stri return Result{} } -// json HTTP_OK with json_s as payload with content-type `application/json` +// json[T] HTTP_OK with json_s as payload with content-type `application/json` pub fn (mut ctx Context) json[T](status http.Status, j T) Result { ctx.status = status ctx.content_type = 'application/json'