devops

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

devops 资源发现、服务发现相关代码.

example dsn: - mysql: user:password@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local - redis: redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discovery

func Discovery(resource ResourceType, app, name, kind string) (string, error)

Discovery 资源发现, 通过读取环境变量实现. app、name、kind 中不允许有下划线 _ name: 资源名称 kind: 资源的类型, 如 master, slave, 是 name 的进一步细分.

func DiscoveryMany

func DiscoveryMany(resource ResourceType, app, name, kind string) (dsns []string, _ error)

DiscoveryMany 资源发现 app: 默认为空, app 独享资源时使用. name: 资源名称 kind: 资源的类型, 如 master, slave, 是 name 的进一步细分. 格式(kind==""): RES_{{type}}_{{app}}__{{name}}_ADDR

func Register

func Register(resource ResourceType, app, name, kind string, dsns []string) (err error)

注册资源

func Sentry

func Sentry() string

Types

type ResourceType

type ResourceType string
const (
	ResourceMySQL  ResourceType = "MySQL"
	ResourceRedis  ResourceType = "Redis" // redis://<user>:<pass>@localhost:6379/<db>
	ResourceKafka  ResourceType = "Kafka"
	ResourceStatsd ResourceType = "Statsd"
)

func (ResourceType) Lower

func (d ResourceType) Lower() string

func (ResourceType) String

func (d ResourceType) String() string

func (ResourceType) Upper

func (d ResourceType) Upper() string

Jump to

Keyboard shortcuts

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