feat: initial release
This commit is contained in:
parent
a3cf21f5bd
commit
1e0ee5bffe
40 changed files with 2007 additions and 217 deletions
23
internal/web/server/util.go
Normal file
23
internal/web/server/util.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.wzray.com/homelab/mastermind/internal/types"
|
||||
)
|
||||
|
||||
func fail(format string, a ...any) []byte {
|
||||
r, _ := json.Marshal(types.Response[string]{
|
||||
Ok: false,
|
||||
Err: fmt.Sprintf(format, a...),
|
||||
})
|
||||
return r
|
||||
}
|
||||
|
||||
func ok[T any](data T) ([]byte, error) {
|
||||
return json.Marshal(types.Response[T]{
|
||||
Ok: true,
|
||||
Data: data,
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue