kstructs

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFunctionWithRows

func CallFunctionWithRows(fn interface{}, rows []map[string]interface{}) error

CallFunctionWithRows was created for helping test the QueryChunks method

func FillSliceWith

func FillSliceWith(entities interface{}, dbRows []map[string]interface{}) error

FillSliceWith is meant to be used on unit tests to mock the response from the database.

The first argument is any slice of structs you are passing to a ksql func, and the second is a slice of maps representing the database rows you want to use to update this struct.

func FillStructWith

func FillStructWith(record interface{}, dbRow map[string]interface{}) error

FillStructWith is meant to be used on unit tests to mock the response from the database.

The first argument is any struct you are passing to a ksql func, and the second is a map representing a database row you want to use to update this struct.

func StructToMap

func StructToMap(obj interface{}) (map[string]interface{}, error)

StructToMap converts any struct type to a map based on the tag named `ksql`, i.e. `ksql:"map_key_name"`

Valid pointers are dereferenced and copied to the map, null pointers are ignored.

This function is efficient in the fact that it caches the slower steps of the reflection required to perform this task.

Types

This section is empty.

Jump to

Keyboard shortcuts

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