datamodels

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 3 Imported by: 14

README

datamodels

Data structures and wrappers in Golang

Documentation

Index

Constants

View Source
const ArgTimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string]any

Map is a nested map with helper methods for recursive lookups

func (Map) Get

func (d Map) Get(key ...string) (any, bool)

Get is a helper for doing recursive lookups into nested maps (nested JSON). Key argument is a slice of strings

func (Map) GetNumber

func (d Map) GetNumber(key ...string) (float64, bool)

GetNumber retrieves JSON numeric value which are by spec floating points

func (Map) GetString

func (d Map) GetString(key ...string) (string, bool)

GetString wraps Get to cast item to string.

func (Map) GetTimestamp

func (d Map) GetTimestamp(key ...string) (time.Time, bool, error)

func (Map) Keywords

func (d Map) Keywords() ([]string, bool)

Keywords implements keyword interface for sigma rule engine. For now it's a stub.

func (Map) Select

func (d Map) Select(key string) (any, bool)

Select implements selection interface for sigma rule engine

func (Map) Set

func (d Map) Set(value any, key ...string) error

type SafeMap added in v0.1.0

type SafeMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSafeMap added in v0.1.0

func NewSafeMap(data Map) *SafeMap

func (*SafeMap) Get added in v0.1.0

func (d *SafeMap) Get(key ...string) (any, bool)

Get is a helper for doing recursive lookups into nested maps (nested JSON). Key argument is a slice of strings

func (*SafeMap) GetNumber added in v0.1.0

func (d *SafeMap) GetNumber(key ...string) (float64, bool)

GetNumber retrieves JSON numeric value which are by spec floating points

func (*SafeMap) GetString added in v0.1.0

func (d *SafeMap) GetString(key ...string) (string, bool)

GetString wraps Get to cast item to string.

func (*SafeMap) GetTimestamp added in v0.1.0

func (d *SafeMap) GetTimestamp(key ...string) (time.Time, bool, error)

func (*SafeMap) Raw added in v0.1.1

func (d *SafeMap) Raw() Map

func (*SafeMap) Set added in v0.1.0

func (d *SafeMap) Set(value any, key ...string) error

Jump to

Keyboard shortcuts

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