test

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

* Copyright (C) 2017 eschao <esc.chao@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConfig

type DBConfig struct {
	Host     string    `cli:"host"     env:"HOST"     json:"host"     usage:"database server hostname"   yaml:"host"`
	Port     int       `cli:"port"     env:"PORT"     json:"port"     usage:"database server port"       yaml:"port"`
	User     string    `cli:"user"     env:"USER"     json:"user"     usage:"database username"          yaml:"user"`
	Password string    `cli:"password" env:"PASSWORD" json:"password" usage:"database user password"     yaml:"password"`
	Log      LogConfig `cli:"log"      env:"LOG_"     json:"log"      usage:"database log configuration" yaml:"log"`
}

type DefValueConfig

type DefValueConfig struct {
	BoolValue    bool          `cli:"bool"       default:"true"                env:"CONFIG_TEST_BOOL"     usage:"boolean value"`
	IntValue     int           `cli:"int"        default:"123"                 env:"CONFIG_TEST_INT"      usage:"int value"`
	Float64Value float64       `cli:"float64"    default:"123.4567"            env:"CONFIG_TEST_FLOAT64"  usage:"float64 value"`
	StrValue     string        `cli:"str"        default:"default-string"      env:"CONFIG_TEST_STR"      usage:"string value"`
	SliceValue   []string      `cli:"slice"      default:"xx:yy:zz"            env:"CONFIG_TEST_SLICE"    usage:"slice values"`
	Interval     time.Duration `cli:"interval"   default:"15s"                 env:"CONFIG_TEST_INTERVAL" usage:"time duration"`
	LogLevel     slog.Level    `cli:"log_level"  default:"INFO"                env:"LOG_LEVEL"            usage:"log level"`
	NoDefValue   string        `cli:"nodefvalue" env:"CONFIG_TEST_NO_DEFVALUE" usage:"no default value"`
}

type LogConfig

type LogConfig struct {
	Path  string `cli:"path"  env:"PATH"  json:"path"  prop:"path"  usage:"log path"                        yaml:"path"`
	Level string `cli:"level" env:"LEVEL" json:"level" prop:"level" usage:"log level {debug|warning|error}" yaml:"level"`
}

type LoginConfig

type LoginConfig struct {
	User     string `cli:"user"     env:"USER"     json:"user"     prop:"user"     usage:"login username" yaml:"user"`
	Password string `cli:"password" env:"PASSWORD" json:"password" prop:"password" usage:"login password" yaml:"password"`
}

type ServiceConfig

type ServiceConfig struct {
	Host     string       `cli:"hostname" env:"CONFIG_TEST_SERVICE_HOST" required:"true" usage:"service hostname"`
	Port     int          `cli:"port"     env:"CONFIG_TEST_SERVICE_PORT" required:"true" usage:"service port"`
	DBConfig DBConfig     `cli:"database" env:"CONFIG_TEST_SERVICE_DB_"    usage:"database configuration"`
	Login    *LoginConfig `cli:"login"    env:"CONFIG_TEST_SERVICE_LOGIN_" usage:"login user and password"`
	Log      LogConfig    `cli:"log"      env:"CONFIG_TEST_SERVICE_LOG_"   usage:"service log configuration"`
}

type SlicesConfig

type SlicesConfig struct {
	Paths  []string `cli:"paths"  env:"CONFIG_TEST_SLICES_PATHS"  usage:"multiple path"`
	Debugs []string `cli:"debugs" env:"CONFIG_TEST_SLICES_DEBUG"  separator:";"         usage:"multiple debug"`
	Values []int    `cli:"values" env:"CONFIG_TEST_SLICES_VALUES" separator:","         usage:"multiple value"`
}

type TypesConfig

type TypesConfig struct {
	BoolValue    bool    `cli:"bool"    env:"CONFIG_TEST_BOOL"    usage:"boolean value"`
	StrValue     string  `cli:"str"     env:"CONFIG_TEST_STR"     usage:"string value"`
	Int8Value    int8    `cli:"int8"    env:"CONFIG_TEST_INT8"    usage:"int8 value"`
	Int16Value   int16   `cli:"int16"   env:"CONFIG_TEST_INT16"   usage:"int16 value"`
	IntValue     int     `cli:"int"     env:"CONFIG_TEST_INT"     usage:"int value"`
	Int32Value   int32   `cli:"int32"   env:"CONFIG_TEST_INT32"   usage:"int32 value"`
	Int64Value   int64   `cli:"int64"   env:"CONFIG_TEST_INT64"   usage:"int64 value"`
	Uint8Value   uint8   `cli:"uint8"   env:"CONFIG_TEST_UINT8"   usage:"uint8 value"`
	Uint16Value  uint16  `cli:"uint16"  env:"CONFIG_TEST_UINT16"  usage:"uint16 value"`
	UintValue    uint    `cli:"uint"    env:"CONFIG_TEST_UINT"    usage:"uint value"`
	Uint32Value  uint32  `cli:"uint32"  env:"CONFIG_TEST_UINT32"  usage:"uint32 value"`
	Uint64Value  uint64  `cli:"uint64"  env:"CONFIG_TEST_UINT64"  usage:"uint64 value"`
	Float32Value float32 `cli:"float32" env:"CONFIG_TEST_FLOAT32" usage:"float32 value"`
	Float64Value float64 `cli:"float64" env:"CONFIG_TEST_FLOAT64" usage:"float64 value"`
}

Jump to

Keyboard shortcuts

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