scanning

package
v0.0.0-...-cb07570 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

nolint: ireturn

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound      = errors.New("key not found")
	ErrValueNotFound    = errors.New("value not found")
	ErrWrongType        = errors.New("wrong type")
	ErrEnvVarNotSet     = errors.New("environment variable not set")
	ErrJSONPathNotFound = errors.New("empty value at json path")
	ErrReaderNotFound   = errors.New("reader not found")
)

Functions

This section is empty.

Types

type EnvReader

type EnvReader struct {
	KeyName string `json:"string" validate:"required"`
	EnvName string `json:"params" validate:"required"`
}

func (*EnvReader) Key

func (r *EnvReader) Key() (string, error)

func (*EnvReader) Value

func (r *EnvReader) Value() (any, error)

type JSONReader

type JSONReader struct {
	KeyName  string `json:"string"   validate:"required"`
	FilePath string `json:"filePath" validate:"required"`
	JSONPath string `json:"jsonPath" validate:"required"`
}

func (*JSONReader) Key

func (r *JSONReader) Key() (string, error)

func (*JSONReader) Value

func (r *JSONReader) Value() (any, error)

type Reader

type Reader interface {
	Value() (any, error)
	Key() (string, error)
}

Reader gets data from source specific to implementation as a key-value pair.

type Registry

type Registry map[string]Reader

Registry of readers capable of scanning data of different type from file, env sources.

func NewRegistry

func NewRegistry() Registry

func (Registry) AddReader

func (c Registry) AddReader(reader Reader) error

func (Registry) AddReaders

func (c Registry) AddReaders(readers ...Reader) error

func (Registry) Get

func (c Registry) Get(key string) (any, error)

func (Registry) GetBool

func (c Registry) GetBool(key string) (bool, error)

func (Registry) GetFloat32

func (c Registry) GetFloat32(key string) (float32, error)

func (Registry) GetFloat64

func (c Registry) GetFloat64(key string) (float64, error)

func (Registry) GetInt

func (c Registry) GetInt(key string) (int, error)

func (Registry) GetInt16

func (c Registry) GetInt16(key string) (int16, error)

func (Registry) GetInt32

func (c Registry) GetInt32(key string) (int32, error)

func (Registry) GetInt64

func (c Registry) GetInt64(key string) (int64, error)

func (Registry) GetInt8

func (c Registry) GetInt8(key string) (int8, error)

func (Registry) GetMap

func (c Registry) GetMap(key string) (map[string]*ajson.Node, error)

func (Registry) GetString

func (c Registry) GetString(key string) (string, error)

func (Registry) GetUint

func (c Registry) GetUint(key string) (uint, error)

func (Registry) GetUint16

func (c Registry) GetUint16(key string) (uint16, error)

func (Registry) GetUint32

func (c Registry) GetUint32(key string) (uint32, error)

func (Registry) GetUint64

func (c Registry) GetUint64(key string) (uint64, error)

func (Registry) GetUint8

func (c Registry) GetUint8(key string) (uint8, error)

func (Registry) MustBool

func (c Registry) MustBool(credKey string) bool

func (Registry) MustFloat32

func (c Registry) MustFloat32(credKey string) float32

func (Registry) MustFloat64

func (c Registry) MustFloat64(credKey string) float64

func (Registry) MustInt

func (c Registry) MustInt(credKey string) int

func (Registry) MustInt16

func (c Registry) MustInt16(credKey string) int16

func (Registry) MustInt32

func (c Registry) MustInt32(credKey string) int32

func (Registry) MustInt64

func (c Registry) MustInt64(credKey string) int64

func (Registry) MustInt8

func (c Registry) MustInt8(credKey string) int8

func (Registry) MustString

func (c Registry) MustString(credKey string) string

func (Registry) MustUint

func (c Registry) MustUint(credKey string) uint

func (Registry) MustUint16

func (c Registry) MustUint16(credKey string) uint16

func (Registry) MustUint32

func (c Registry) MustUint32(credKey string) uint32

func (Registry) MustUint64

func (c Registry) MustUint64(credKey string) uint64

func (Registry) MustUint8

func (c Registry) MustUint8(credKey string) uint8

type ValueReader

type ValueReader struct {
	KeyName string `json:"string" validate:"required"`
	Val     any    `json:"val"    validate:"required"`
}

func (*ValueReader) Key

func (r *ValueReader) Key() (string, error)

func (*ValueReader) Value

func (r *ValueReader) Value() (any, error)

Directories

Path Synopsis
Package credscanning is a wrapper for scanning package.
Package credscanning is a wrapper for scanning package.

Jump to

Keyboard shortcuts

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