_interface

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

_interface 接口库

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallBack

type CallBack interface {
	// ChangeConfCallBack
	// 配置更改回调
	ChangeConfCallBack()

	// DestructCallBack
	// 程序退出回调
	DestructCallBack()

	// InitCallBack
	// 初始化回调
	InitCallBack()
}

type Conf

type Conf interface {
	CallBack

	// GetConfig
	// 获取所有配置
	GetConfig() map[string]string

	// GetConfigObj
	// 获取所有配置对象
	GetConfigObj() map[string]*models.ConfParam

	// GetConfigKeys
	// 获取所有配置的键值
	GetConfigKeys() []string

	// GetConfVal
	// 获取单个配置
	GetConfVal(string) string

	// SetConfig
	// 设置一个配置变量(若存在则覆盖, 不存在不会创建,需要先注册)
	SetConfParam(string, string, string, int64)

	// ReloadConfig
	// 重载配置
	ReloadConfig()

	// RegisterConfParam
	// 注册配置,已拥有,则不覆盖
	RegisterConfParam(string, string, string, int64, bool)
}

type Database

type Database interface {
	// Get
	// 获取值
	Get(string) string

	// Set
	// 设置值
	Set(string, string)

	// SetWiteTTL
	// 设置值同时设置过期时间
	SetWiteTTL(string, string, time.Duration)
}

Database 数据库, 对github.com/dgraph-io/badger包的二次封装

type Log

type Log interface {
	// 兼容badger数据库日志接口
	badger.Logger

	CallBack
	// WriteLog
	// 写入日志
	WriteLog(*LogMsgType)

	// SetLogLevel
	// 修改日志等级, 如果日志等级比传入的等级低则不会写入该日志
	SetLogLevel(string)

	// GetLines
	// 按行分页获取日志, 第一个int为页码,第二个为一页的有多少行
	GetLines(int, int) []string

	// CompressLogs
	// 压缩日志 传空字符串就表是压缩在当前文件夹内
	CompressLogs(path string) error

	io.Writer
}

log 日志接口

type LogMsgType

type LogMsgType struct {
	Message     string
	Level       string
	IsNotFormat bool
}

type ServerAdapter added in v1.1.0

type ServerAdapter interface {
	// 获取版本
	GetVersionRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 获取游戏模式
	GetGameTypeRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 游戏开始
	GetGameStartRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 游戏保存(结束)
	GetGameSaveRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 获取玩家发言
	GetMessageRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 加入游戏
	GetPlayerJoinRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 离开游戏
	GetPlayerLeftRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 获得成就
	GetPlayerAdvancementRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
	// 玩家死亡
	GetPlayerDeathRegularExpression(originMsg string) (res *models.ReciveMessage, ok bool)
}

Directories

Path Synopsis
server 接口
server 接口

Jump to

Keyboard shortcuts

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