123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package types
- import (
- "encoding/json"
- "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/api/errs"
- )
- type Map = map[string]interface{}
- func String(str string) *string {
- return &str;
- }
- func True() *bool {
- value := true
- return &value
- }
- func False() *bool {
- value := false
- return &value
- }
- func Bool(value bool) *bool {
- return &value
- }
- func Int(value int) *int {
- return &value
- }
- func Int32(value int32) *int32 {
- return &value
- }
- func Int64(value int64) *int64 {
- return &value
- }
- func Float64(value float64) *float64 {
- return &value
- }
- func Float32(value float32) *float32 {
- return &value
- }
- func JSON(data interface{}) (jsonData string,err *errs.Error) {
- out, errorMarshal := json.Marshal(data)
- if errorMarshal != nil {
- err = errs.Internal().Details(&errs.Detail{
- Reason: "failedConvertToJSON",
- Message : errorMarshal.Error(),
- })
- }else {
- jsonData = string(out)
- }
- return
- }
|