dto

package
v0.30.75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoJSONArray

func DoJSONArray(strs []string) string

DoJSONArray returns a JSON array in string from strings given.

func FromGOB

func FromGOB(data []byte, dto interface{})

FromGOB reads object from bytes. Remember pass a pointer to preallocated object of the right type.

p := &PSM{}
dto.FromGOB(d, p)
return p

func FromJSON

func FromJSON(bytes []byte, dto interface{})

FromJSON is a helper to convert byte JSON to a data object.

func FromJSONStr

func FromJSONStr(str string, dto interface{})

FromJSONStr is a helper to convert object from a JSON string.

func JSONArray

func JSONArray(strs ...string) string

JSONArray returns a JSON array in string from strings given.

func ToGOB

func ToGOB(dto interface{}) []byte

ToGOB returns bytes of the object in GOB format.

func ToJSON

func ToJSON(dto interface{}) string

ToJSON is a helper to convert dto to JSON string.

func ToJSONBytes

func ToJSONBytes(dto interface{}) []byte

ToJSONBytes is a helper to convert dto to JSON byte data.

Types

type Data

type Data struct {
	Handle int    `json:"handle,omitempty"`
	Str1   string `json:"str_1,omitempty"`
	Str2   string `json:"str_2,omitempty"`
	Str3   string `json:"str_3,omitempty"`
	U64    uint64 `json:"u_64,omitempty"`
	Bytes  []byte `json:"bytes,omitempty"`
	Yes    bool   `json:"yes,omitempty"`
}

Data is the actual data from wrapper function's return values when function call is successful.

type Err

type Err struct {
	Error string `json:",omitempty"`
	Code  int    `json:",omitempty"`
}

Err is the error part of the Result type of the wrapper function return types.

type ErrorJSON

type ErrorJSON struct {
	Backtrace string `json:"backtrace,omitempty"`
	Message   string `json:"message"`
}

ErrorJSON is wrapper struct for libindy's corresponding JSON type.

func NewErrorJSON

func NewErrorJSON(js string) (msg *ErrorJSON)

NewErrorJSON creates a new ErrorJSON

type Result

type Result struct {
	Er   Err  `json:",omitempty"`
	Data Data `json:",omitempty"`
}

Result is the return type result of the wrapper functions

func (Result) Bytes

func (r Result) Bytes() []byte

Bytes returns bytes.

func (Result) Err

func (r Result) Err() error

Err returns Go error.

func (Result) ErrCode

func (r Result) ErrCode() int

ErrCode returns an indy error code.

func (Result) Error

func (r Result) Error() string

Error is Go error method to make Result error compatible.

func (Result) Handle

func (r Result) Handle() int

Handle return the Handle part of the result.

func (*Result) SetBytes

func (r *Result) SetBytes(bytes []byte)

SetBytes sets bytes part of the Result.

func (*Result) SetErr

func (r *Result) SetErr(e error)

SetErr sets the Go error for Result.

func (*Result) SetErrCode

func (r *Result) SetErrCode(c int)

SetErrCode sets an indy error code.

func (*Result) SetErrorJSON

func (r *Result) SetErrorJSON(jsonString string)

SetErrorJSON sets error data from json string of the Result.

func (*Result) SetHandle

func (r *Result) SetHandle(h int)

SetHandle sets the Handle data part of the Result.

func (*Result) SetStr1

func (r *Result) SetStr1(s string)

SetStr1 sets 1st string value of the Result.

func (*Result) SetStr2

func (r *Result) SetStr2(s string)

SetStr2 sets 1st string value of the Result.

func (*Result) SetStr3

func (r *Result) SetStr3(s string)

SetStr3 sets 3rd string value of the Result.

func (*Result) SetU64

func (r *Result) SetU64(v uint64)

SetU64 set corresponding part of the Result.

func (*Result) SetYes

func (r *Result) SetYes(v bool)

SetYes sets the bool part of the Result.

func (Result) Str1

func (r Result) Str1() string

Str1 returns 1st string.

func (Result) Str2

func (r Result) Str2() string

Str2 returns 2nd string.

func (*Result) Str3

func (r *Result) Str3() string

Str3 returns 3rd string.

func (Result) String

func (r Result) String() string

func (*Result) Uint64

func (r *Result) Uint64() uint64

Uint64 return a corresponding part of the Result.

func (Result) Yes

func (r Result) Yes() bool

Yes return the bool part of the Result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL