Gave all modules own directory; added test CI pipeline
Some checks failed
ci/woodpecker/push/arch unknown status
ci/woodpecker/push/docker unknown status
ci/woodpecker/push/lint Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Jef Roosens 2022-04-10 16:48:37 +02:00
parent 6d60ea1538
commit f92a20fcf8
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
8 changed files with 27 additions and 8 deletions

34
src/response/response.v Normal file
View file

@ -0,0 +1,34 @@
module response
pub struct Response<T> {
pub:
message string
data T
}
// new_response constructs a new Response<String> object with the given message
// & an empty data field.
pub fn new_response(message string) Response<string> {
return Response<string>{
message: message
data: ''
}
}
// new_data_response<T> constructs a new Response<T> object with the given data
// & an empty message field.
pub fn new_data_response<T>(data T) Response<T> {
return Response<T>{
message: ''
data: data
}
}
// new_full_response<T> constructs a new Response<T> object with the given
// message & data.
pub fn new_full_response<T>(message string, data T) Response<T> {
return Response<T>{
message: message
data: data
}
}