cfx

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatClientModule = fx.Provide(
	func(
		setting ChatSettingParams,
		sSetting sfx.SecuritySettingsParams,
	) (out ChatClientResult, err error) {
		if cli, e := NewChatClient(setting.ChatUrl, sSetting); e != nil {
			err = e
		} else {
			out.ChatClient = cli
		}
		return
	},
)
View Source
var ChatPrivateClientModule = fx.Provide(
	func(
		setting ChatSettingParams,
		sSetting sfx.SecuritySettingsParams,
	) (out ChatPrivateClientResult, err error) {
		if cli, e := NewChatPrivateClient(setting.ChatUrl, sSetting); e != nil {
			err = e
		} else {
			out.ChatClient = cli
		}
		return
	},
)
View Source
var ChatSettingsModule = fx.Provide(
	func() (out ChatSettingResult, err error) {
		err = out.LoadFromEnv()
		return
	},
)

Functions

func NewChatClient

func NewChatClient(host string, sSetting sfx.SecuritySettingsParams) (pb.ChatServiceClient, error)

func NewChatPrivateClient

func NewChatPrivateClient(host string, sSetting sfx.SecuritySettingsParams) (pb.ChatPrivateServiceClient, error)

Types

type ChatClientParams

type ChatClientParams struct {
	fx.In

	ChatClient pb.ChatServiceClient `name:"ChatClient"`
}

type ChatClientResult

type ChatClientResult struct {
	fx.Out

	ChatClient pb.ChatServiceClient `name:"ChatClient"`
}

type ChatPrivateClientParams

type ChatPrivateClientParams struct {
	fx.In

	ChatClient pb.ChatPrivateServiceClient `name:"ChatPrivateClient"`
}

type ChatPrivateClientResult

type ChatPrivateClientResult struct {
	fx.Out

	ChatClient pb.ChatPrivateServiceClient `name:"ChatPrivateClient"`
}

type ChatSettingParams

type ChatSettingParams struct {
	fx.In
	Name         string `name:"ChatName"`
	ChatUrl      string `name:"ChatUrl"`
	ChatInterval int    `name:"ChatInterval"`
}

type ChatSettingResult

type ChatSettingResult struct {
	fx.Out
	Name         string `name:"ChatName" envconfig:"CHAT_NAME" default:"chat"`
	ChatUrl      string `name:"ChatUrl" envconfig:"CHAT_URL" default:"localhost:8081"`
	ChatInterval int    `name:"ChatInterval" envconfig:"WORLD_CHAT_INTERVAL" default:"2"`
}

func (*ChatSettingResult) LoadFromEnv

func (l *ChatSettingResult) LoadFromEnv() (err error)

Jump to

Keyboard shortcuts

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