utils

package
v4.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package schemaregistry provides a client for Confluent's Kafka Schema Registry REST API. https://github.com/Landoop/schema-registry/tree/0.1.0

Index

Constants

View Source
const TimeLayout = "2006-01-02T15:04:05.000"

TimeLayout is the myrtea default time layout

Variables

View Source
var DefaultURL = "http://localhost:8081"

DefaultURL is the address where a local schema registry listens by default.

Functions

func DeleteNestedMap

func DeleteNestedMap(pathParts []string, data map[string]interface{}) bool

DeleteNestedMap delete a specific path value in a map

func FlattenFact

func FlattenFact(dataArray []interface{}, pathKey string, pathValue string) map[string]interface{}

func GetBeginningOfDay

func GetBeginningOfDay(t time.Time) string

GetBeginningOfDay return input time with time 00:00:00 formated to elasticsearch standard format

func GetBeginningOfMonth

func GetBeginningOfMonth(t time.Time) string

GetBeginningOfMonth beginning of month

func GetBeginningOfYear

func GetBeginningOfYear(t time.Time) string

GetBeginningOfYear beginning of year

func GetDailyRange

func GetDailyRange(t time.Time) []string

GetDailyRange returns a range of time for the current day (from 00:00:00 to now) with 1 value per hour

func GetEndOfDay

func GetEndOfDay(t time.Time) string

GetEndOfDay return input time with time 00:00:00 formated to elasticsearch standard format

func GetEndOfMonth

func GetEndOfMonth(t time.Time) string

GetEndOfMonth beginning of month

func GetEndOfYear

func GetEndOfYear(t time.Time) string

GetEndOfYear beginning of year

func GetTime

func GetTime(t time.Time) string

GetTime return now time formated to elasticsearch standard format

func GetTimeZone

func GetTimeZone(t time.Time) string

GetTimeZone return timezone of the input time

func LookupNestedMap

func LookupNestedMap(pathParts []string, data map[string]interface{}) (interface{}, bool)

LookupNestedMap lookup for a value corresponding to the exact specified path inside a map

func NewUUIDFromBits added in v4.1.3

func NewUUIDFromBits(uuidMostSig int64, uuidLeastSig int64) string

New return a formatted UUID based on two int64

func PatchNestedMap

func PatchNestedMap(pathParts []string, data map[string]interface{}, newValue interface{}) bool

PatchNestedMap update a specific path value in a map

Types

type CachedSchemaRegistry added in v4.1.3

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

CachedSchemaRegistry :

func NewCachedSchemaRegistry added in v4.1.3

func NewCachedSchemaRegistry(url string, ttlCacheDuration time.Duration) (*CachedSchemaRegistry, error)

NewCachedSchemaRegistry :

func (CachedSchemaRegistry) GetSchemaByID added in v4.1.3

func (reg CachedSchemaRegistry) GetSchemaByID(id int) (string, error)

GetSchemaByID :

func (CachedSchemaRegistry) GetSchemaBySubject added in v4.1.3

func (reg CachedSchemaRegistry) GetSchemaBySubject(subjectStr string, version int) (Schema, error)

GetSchemaBySubject :

type Client added in v4.1.3

type Client interface {
	Subjects() (subjects []string, err error)
	Versions(subject string) (versions []int, err error)
	RegisterNewSchema(subject, schema string) (int, error)
	IsRegistered(subject, schema string) (bool, Schema, error)
	GetSchemaByID(id int) (string, error)
	GetSchemaBySubject(subject string, ver int) (s Schema, err error)
	GetLatestSchema(subject string) (s Schema, err error)
}

A Client is a client for the schema registry.

func NewClient added in v4.1.3

func NewClient(baseurl string) (Client, error)

NewClient returns a new Client that connects to baseurl.

type Schema added in v4.1.3

type Schema struct {
	Schema  string `json:"schema"`  // The actual AVRO schema
	Subject string `json:"subject"` // Subject where the schema is registered for
	Version int    `json:"version"` // Version within this subject
	ID      int    `json:"id"`      // Registry's unique id
}

The Schema type is an object produced by the schema registry.

type ZapLeveledLogger added in v4.1.3

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

func NewZapLeveledLogger added in v4.1.3

func NewZapLeveledLogger(logger *zap.Logger) ZapLeveledLogger

func (ZapLeveledLogger) Debug added in v4.1.3

func (logger ZapLeveledLogger) Debug(msg string, keysAndValues ...interface{})

func (ZapLeveledLogger) Error added in v4.1.3

func (logger ZapLeveledLogger) Error(msg string, keysAndValues ...interface{})

func (ZapLeveledLogger) Info added in v4.1.3

func (logger ZapLeveledLogger) Info(msg string, keysAndValues ...interface{})

func (ZapLeveledLogger) Warn added in v4.1.3

func (logger ZapLeveledLogger) Warn(msg string, keysAndValues ...interface{})

Jump to

Keyboard shortcuts

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