utils

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertStruct added in v0.1.12

func ConvertStruct(from interface{}, to interface{}) (interface{}, error)

ConvertStruct converts a GRPC struct to a given struct

Usage:

filledGoClientStruct, err := ConvertStruct(grpcStruct, emptyGoClientStruct)
grpcStruct - The struct returned from gRPC calls.
emptyGoClientStruct - The empty go client struct. This could be:
        "(*Foo)(nil)" or "&Foo{}". But this can not be "nil". That's
        because the code can not tell the type if it's just a nil
        interface. This struct is never filled in. It's only used
        to tell the type of the Go client struct so that it can
        be constructed, filled in, and returned
filledGoClientStruct - This is the filled in Go client struct. This
        is created from the type of emptyGoClientStruct. This is why
        emptyGoClientStruct can not be just nil. This return value
        is always a pointer of the base type of emptyGoClientStruct.
        For example, the return value could be of type "*Foo",
        "*[]*Foo", or "*map[string]*Foo".

func FetchFileLoc

func FetchFileLoc(relativeFilePath string) (string, error)

FetchFileLoc fetches the file location relative to the module root, eg. the same directory as go.mod.

Types

This section is empty.

Jump to

Keyboard shortcuts

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