utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallGenerator

func CallGenerator(ctx context.Context, tc *structs.TestCase, configDir string) ([]byte, error)

func Contains

func Contains(array interface{}, obj interface{}) bool

判断数组、切片或Map是否存在某个值

func GetCompiledBinaryFileAbsPath

func GetCompiledBinaryFileAbsPath(typeName, moduleName, configDir string) (string, error)

根据配置文件将对应预编译文件转换成绝对路径

func GetCompiledBinaryFileName

func GetCompiledBinaryFileName(typeName, moduleName string) string

func GetSessionDir

func GetSessionDir(workDir string, sessionId string) (string, error)

create and get session directory

func IsExecutableFile

func IsExecutableFile(filePath string) (bool, error)

func IsProblemPackage added in v0.0.3

func IsProblemPackage(filePath string) (bool, error)

判断是否是题目包

func IsZipFile added in v0.0.3

func IsZipFile(filePath string) (bool, error)

判断是否是题目包

func JSONBytesObject

func JSONBytesObject(jsonBytes []byte, obj interface{}) bool

func JSONStringObject

func JSONStringObject(jsonStr string, obj interface{}) bool

func ObjectToJSONByte

func ObjectToJSONByte(obj interface{}) []byte

func ObjectToJSONString

func ObjectToJSONString(obj interface{}) string

func ObjectToJSONStringFormatted

func ObjectToJSONStringFormatted(conf interface{}) string

func ParseGeneratorScript

func ParseGeneratorScript(script string) (string, []string, error)

解析generator脚本

func RunUnixShell

func RunUnixShell(options *structs.ShellOptions) (*structs.ShellResult, error)

运行UnixShell,支持context

func XMLBytesObject

func XMLBytesObject(xmlStr []byte, obj interface{}) bool

func XMLStringObject

func XMLStringObject(xmlStr string, obj interface{}) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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