utils

package
v0.0.0-...-a9e9222 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package utils defines some common varients.

Index

Constants

View Source
const (
	JK_RESULT_SUCCESS = 0
	JK_RESULT_OK      = 200
	JK_RESULT_E_FAIL  = -100 - iota
	JK_RESULT_E_PARAM_ERROR
	JK_RESULT_E_PARSE_ERROR
	JK_RESULT_E_DATABASE_QUERY_ERROR
	JK_RESULT_E_DATABASE_INSERT_ERROR
	JK_RESULT_E_DATABASE_MOD_ERROR
	JK_RESULT_E_DATABASE_REMOVE_ERROR
	JK_RESULT_E_NOT_EXIST
	JK_RESULT_E_HAS_EXIST
	JK_RESULT_E_DATA_NOT_EXIST
	JK_RESULT_E_CODE_ERROR
	JK_RESULT_E_NET_DIAL_ERROR
	JK_RESULT_E_TIME_FAST
	JK_RESULT_E_NOTSUPPORT
	JK_RESULT_E_NO_PERMISSION
)
View Source
const (
	JK_NET_ADDRESS_LOCAL = "0.0.0.0"
	JK_NET_ADDRESS_PORT  = 23888

	JK_SERVER_FILE_POSITION = "kflogs"
)

Variables

This section is empty.

Functions

func BytesToInt

func BytesToInt(buf []byte) int64

func BytesToInt32

func BytesToInt32(buf []byte) int32

func BytesToUInt32

func BytesToUInt32(buf []byte) uint32

func Int32ToBytes

func Int32ToBytes(val int32) []byte

func IntToBytes

func IntToBytes(v int64, cnts int) []byte

how many bytes to use @cnts

func JKBitValue

func JKBitValue(value, start, cout uint) uint

0000 0000 0000 0000 0000 0000 00000 0000

func JKBitValueByte

func JKBitValueByte(value byte, start, cout uint) uint

func JKFileLists

func JKFileLists(path string, dir, file bool) ([]string, error)

Give a filepath return all the directory or files @dir: if get directory @file: if get files.

func JKReadFileData

func JKReadFileData(filename string) (string, error)

func JKSaveDataToFile

func JKSaveDataToFile(filename string, data []byte, clear bool) error

func JKSaveFileData

func JKSaveFileData(id, filename, data string) bool

Types

type M

type M map[string]interface{}

type Result

type Result struct {
	Status int
	Desc   string
	Data   interface{}
}

func ResultNew

func ResultNew(status int, desc string) *Result

func (*Result) GetData

func (r *Result) GetData() interface{}

func (*Result) GetDesc

func (r *Result) GetDesc() string

func (*Result) GetStatus

func (r *Result) GetStatus() int

func (Result) JavaClassName

func (Result) JavaClassName() string

func (*Result) Set401

func (r *Result) Set401()

func (*Result) SetData

func (r *Result) SetData(data interface{})

func (*Result) SetItemExist

func (r *Result) SetItemExist()

func (*Result) SetItemNotExist

func (r *Result) SetItemNotExist()

func (*Result) SetOK

func (r *Result) SetOK()

type ResultStatus

type ResultStatus struct {
	RS map[string]interface{}
}

func NewResultStatus

func NewResultStatus(v int, desc string) *ResultStatus

func (*ResultStatus) GetCode

func (rs *ResultStatus) GetCode() int

func (*ResultStatus) GetData

func (rs *ResultStatus) GetData(result interface{})

func (*ResultStatus) GetDesc

func (rs *ResultStatus) GetDesc() string

func (*ResultStatus) SetArgsInvalid

func (rs *ResultStatus) SetArgsInvalid()

func (*ResultStatus) SetCustom

func (rs *ResultStatus) SetCustom(v int, desc string)

func (*ResultStatus) SetData

func (rs *ResultStatus) SetData(data interface{})

func (*ResultStatus) SetInsertFail

func (rs *ResultStatus) SetInsertFail()

func (*ResultStatus) SetItemDelFail

func (rs *ResultStatus) SetItemDelFail()

func (*ResultStatus) SetItemExist

func (rs *ResultStatus) SetItemExist()

func (*ResultStatus) SetItemModFail

func (rs *ResultStatus) SetItemModFail()

func (*ResultStatus) SetItemNotExist

func (rs *ResultStatus) SetItemNotExist()

func (*ResultStatus) SetNoPermission

func (rs *ResultStatus) SetNoPermission()

Jump to

Keyboard shortcuts

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