utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToStr

func BoolToStr(value bool) string

func GetFirstItemValue

func GetFirstItemValue(getFunc func(key string) interface{}, key string) interface{}

func HTTPRequest

func HTTPRequest(method, url string, body []byte, headers map[string]string, Username string, Password string) (*http.Response, error)

func HandleError

func HandleError(resourceName, message string, err error) error

HandleError handles errors and returns a CustomError if necessary.

func MarshalExcludeFields

func MarshalExcludeFields(v interface{}, excludeFields []string) ([]byte, error)

func MarshalNonZeroFields

func MarshalNonZeroFields(v interface{}) ([]byte, error)

func SetConfigValues

func SetConfigValues(config interface{}, commonConfig Configuration)

SetConfigValues sets common configuration values for a given config struct.

Types

type Configuration

type Configuration struct {
	Username string
	Password string
	BaseURL  string
}

Configuration holds the common configuration values.

type CustomError

type CustomError struct {
	ResourceName string
	Message      string
	Err          error
}

CustomError represents

func NewCustomError

func NewCustomError(resourceName, message string, err error) *CustomError

NewCustomError creates a new CustomError instance.

func (*CustomError) Error

func (ce *CustomError) Error() string

Jump to

Keyboard shortcuts

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