zdpgo_nacos

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 6 Imported by: 0

README

zdpgo_nacos

go操作nacos

版本历史

  • v0.1.0 2022/07/24 新增:基础功能

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host      string `mapstructure:"host"`      // 主机地址
	Port      uint64 `mapstructure:"port"`      // 主机端口号
	Namespace string `mapstructure:"namespace"` // 名称空间
	User      string `mapstructure:"user"`      // 用户
	Password  string `mapstructure:"password"`  //密码
	DataId    string `mapstructure:"dataid"`    // dataid
	Group     string `mapstructure:"group"`     // 组
}

Config nacos配置

type ConsulConfig

type ConsulConfig struct {
	Host string `mapstructure:"host" json:"host"` // 主机
	Port int    `mapstructure:"port" json:"port"` // 端口号
}

ConsulConfig consul配置

type MysqlConfig

type MysqlConfig struct {
	Host     string `mapstructure:"host" json:"host"`         // 主机地址
	Port     int    `mapstructure:"port" json:"port"`         // 端口号
	Name     string `mapstructure:"db" json:"database"`       // 数据库名称
	User     string `mapstructure:"user" json:"username"`     // 用户名
	Password string `mapstructure:"password" json:"password"` // 密码
}

MysqlConfig MySQL配置信息

type Nacos

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

Nacos nacos核心对象

func New

func New(config NacosConfig) *Nacos

func (*Nacos) GetContent

func (n *Nacos) GetContent(dataId, group string) (content string)

GetContent 获取nacos配置信息 @param dataId 配置组id @param group 配置组名称 @return content 配置内容

func (*Nacos) ListenConfig

func (n *Nacos) ListenConfig(dataId, group string, config interface{}) error

ListenConfig 监听nacos配置 @param group 配置组名称 @param content 配置内容 @param config 配置对象

func (*Nacos) ParseJsonConfig

func (n *Nacos) ParseJsonConfig(config interface{}, jsonContent string)

ParseJsonConfig 解析Json配置 @param config 配置对象 @param jsonContent json配置内容

type NacosConfig

type NacosConfig struct {
	Debug       bool   // 是否为debug模式
	LogFilePath string // 日志文件路径
	Host        string // nacos主机地址
	Port        uint16 // nacos端口号
	NamespaceID string // 名称空间id
	Username    string // 用户名
	Password    string // 密码
}

type ServiceConfig

type ServiceConfig struct {
	Name       string       `mapstructure:"name" json:"name"`     // 服务名称
	MysqlInfo  MysqlConfig  `mapstructure:"mysql" json:"mysql"`   // MySQL配置
	ConsulInfo ConsulConfig `mapstructure:"consul" json:"consul"` // consul配置
}

ServiceConfig service配置

Directories

Path Synopsis
Package errors provides errors that have stack-traces.
Package errors provides errors that have stack-traces.
Package ini provides INI file read and write functionality in Go.
Package ini provides INI file read and write functionality in Go.
Package jsoniter implements encoding and decoding of JSON as defined in RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json.
Package jsoniter implements encoding and decoding of JSON as defined in RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json.
mock
gomock
Package gomock is a mock framework for Go.
Package gomock is a mock framework for Go.
gomock/internal/mock_gomock
Package mock_gomock is a generated GoMock package.
Package mock_gomock is a generated GoMock package.
sample
Package user is an example package with an interface.
Package user is an example package with an interface.
sample/concurrent
Package concurrent demonstrates how to use gomock with goroutines.
Package concurrent demonstrates how to use gomock with goroutines.
sample/concurrent/mock
Package mock_concurrent is a generated GoMock package.
Package mock_concurrent is a generated GoMock package.
nacos
clients/naming_client
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
common/http_agent
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
inner/uuid
Package uuid provides implementation of Universally Unique Identifier (UUID).
Package uuid provides implementation of Universally Unique Identifier (UUID).
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
vo
Package errors provides simple error handling primitives.
Package errors provides simple error handling primitives.
sdk
auth/credentials/providers
Package providers Deprecated
Package providers Deprecated
endpoints
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
test
toolkits_concurrent

Jump to

Keyboard shortcuts

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