common

package
v0.0.0-...-7b7c10a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// LogLevelFlagName is the flag name used for setting the default log level.
	LogLevelFlagName = "log-level"
	// LogLevelEnvKey is the env var name used for setting the default log level.
	LogLevelEnvKey = "LOG_LEVEL"
	// LogLevelFlagShorthand is the shorthand flag name used for setting the default log level.
	LogLevelFlagShorthand = "l"
	// LogLevelPrefixFlagUsage is the usage text for the log level flag.
	LogLevelPrefixFlagUsage = "Logging level to set. Supported options: CRITICAL, ERROR, WARNING, INFO, DEBUG." +
		`Defaults to info if not set. Setting to debug may adversely impact performance. Alternatively, this can be ` +
		"set with the following environment variable: " + LogLevelEnvKey
)
View Source
const (
	// DatabaseURLFlagName is the database url.
	DatabaseURLFlagName = "database-url"
	// DatabaseURLFlagUsage describes the usage.
	DatabaseURLFlagUsage = "Database URL with credentials if required." +
		" Format must be <driver>:[//]<driver-specific-dsn>." +
		" Examples: 'mysql://root:secret@tcp(localhost:3306)/adapter', 'mem://test'," +
		" 'mongodb://mongodb.example.com:27017'." +
		" Supported drivers are [mem, mysql, couchdb, mongodb]." +
		" Alternatively, this can be set with the following environment variable: " + DatabaseURLEnvKey
	// DatabaseURLEnvKey is the databaes url.
	DatabaseURLEnvKey = "DATABASE_URL"

	// DatabaseTimeoutFlagName is the database timeout.
	DatabaseTimeoutFlagName = "database-timeout"
	// DatabaseTimeoutFlagUsage describes the usage.
	DatabaseTimeoutFlagUsage = "Total time in seconds to wait until the datasource is available before giving up." +
		" Default: " + string(rune(DatabaseTimeoutDefault)) + " seconds." +
		" Alternatively, this can be set with the following environment variable: " + DatabaseTimeoutEnvKey
	// DatabaseTimeoutEnvKey is the database timeout.
	DatabaseTimeoutEnvKey = "DATABASE_TIMEOUT"

	// DatabasePrefixFlagName is the storage prefix.
	DatabasePrefixFlagName = "database-prefix"
	// DatabasePrefixEnvKey is the storage prefix.
	DatabasePrefixEnvKey = "DATABASE_PREFIX"
	// DatabasePrefixFlagUsage describes the usage.
	DatabasePrefixFlagUsage = "An optional prefix to be used when creating and retrieving underlying databases. " +
		"Alternatively, this can be set with the following environment variable: " + DatabasePrefixEnvKey

	// DatabaseTimeoutDefault is the default storage timeout.
	DatabaseTimeoutDefault = 30
)

Variables

This section is empty.

Functions

func CreateJSONLDDocumentLoader

func CreateJSONLDDocumentLoader(ldStore ldStoreProvider, client httpClient, providerURLs []string,
) (jsonld.DocumentLoader, error)

CreateJSONLDDocumentLoader creates a new JSON-LD document loader. nolint:ireturn

func Flags

func Flags(cmd *cobra.Command)

Flags registers common command flags.

func InitStore

func InitStore(params *DBParameters, logger log.Logger) (storage.Provider, error)

InitStore provider.

func SetDefaultLogLevel

func SetDefaultLogLevel(logger log.Logger, userLogLevel string)

SetDefaultLogLevel sets the default log level.

Types

type DBParameters

type DBParameters struct {
	URL     string
	Prefix  string
	Timeout uint64
}

DBParameters holds database configuration.

func DBParams

func DBParams(cmd *cobra.Command) (*DBParameters, error)

DBParams fetches the DB parameters configured for this command.

type LDStoreProvider

type LDStoreProvider struct {
	ContextStore        ldstore.ContextStore
	RemoteProviderStore ldstore.RemoteProviderStore
}

LDStoreProvider provides stores for JSON-LD contexts and remote providers.

func CreateLDStoreProvider

func CreateLDStoreProvider(storageProvider storage.Provider) (*LDStoreProvider, error)

CreateLDStoreProvider creates a new LDStoreProvider.

func (*LDStoreProvider) JSONLDContextStore

func (p *LDStoreProvider) JSONLDContextStore() ldstore.ContextStore

JSONLDContextStore returns a JSON-LD context store.

func (*LDStoreProvider) JSONLDRemoteProviderStore

func (p *LDStoreProvider) JSONLDRemoteProviderStore() ldstore.RemoteProviderStore

JSONLDRemoteProviderStore returns a JSON-LD remote provider store.

Jump to

Keyboard shortcuts

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