pkg

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

dataq.go defines the Surfer object and its methods

helpers.go includes all utility (not exported) functions

Main and only package of DataQ dataq.go defines the Surfer object and its methods

Index

Constants

View Source
const (
	T_PTR           = 0
	T_STRUCT        = 1
	T_INT           = 2
	T_INT64         = 3
	T_FLOAT32       = 4
	T_FLOAT64       = 5
	T_STRING        = 6
	T_BOOL          = 7
	T_MAP           = 8
	T_NOT_SUPPORTED = -1
)

custom standardization for supported data types

View Source
const (
	Default_sep = "."
)

Variables

This section is empty.

Functions

func Compare

func Compare(f1 interface{}, f2 interface{}) (bool, error)

Two fields comparison without first knowing their types

Types

type Surfer

type Surfer struct {
	// contains filtered or unexported fields
}

func NewSurfer

func NewSurfer(opts ...SurferOption) *Surfer

NewSurfer creates a pointer to a new Surfer object with default configuration

func (Surfer) GetBool

func (s Surfer) GetBool(name string, source interface{}) (bool, error)

GetBool returns the bool value of the given field

func (Surfer) GetFlatData

func (s Surfer) GetFlatData(source interface{}) (map[string]interface{}, error)

GetFlatData returns a map of interface{} including all fields extracted from the source

func (Surfer) GetFloat64

func (s Surfer) GetFloat64(name string, source interface{}) (float64, error)

GetBool returns the float64 value of the given field

func (Surfer) GetInt64

func (s Surfer) GetInt64(name string, source interface{}) (int64, error)

GetInt64 returns the int64 value of the given field

func (Surfer) GetString

func (s Surfer) GetString(name string, source interface{}) (string, error)

GetString returns the string value of the given field

type SurferOption

type SurferOption func(*Surfer)

func WithSep

func WithSep(sep string) SurferOption

WithSep sets the separation string for the fully qualified name of the fields

Jump to

Keyboard shortcuts

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