common

package
v0.0.0-...-b192f38 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: AGPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// OffsetDefault offset default
	OffsetDefault = 0
	// OffsetMin offset min
	OffsetMin = 0
	// LimitDefault limit default
	LimitDefault = 10
	// LimitMax limit max
	LimitMax = 100
)

Variables

View Source
var ErrCodeMsg = map[ErrCode][]string{}/* 103 elements not displayed */

ErrCodeMsg err code msg

View Source
var ErrCodeName = map[ErrCode]string{
	ErrCodeOK:          "ErrCodeOK",
	ErrorParamWrong:    "ErrorParamWrong",
	ErrorHandleFailure: "ErrorHandleFailure",
	InternalError:      "InternalError",
	ErrorTokenNone:     "ErrorTokenNone",
	ErrorTokenExpired:  "ErrorTokenExpired",
	ErrorTokenMismatch: "ErrorTokenMismatch",

	ErrorUserExisted:         "ErrorUserExisted",
	ErrorAuthFailure:         "ErrorAuthFailure",
	ErrorOldPassword:         "ErrorOldPassword",
	ErrorOldEqualNewPassword: "ErrorOldEqualNewPassword",
	ErrorLoginOut:            "ErrorLoginOut",
	ErrorUserNotExisted:      "ErrorUserNotExisted",
	ErrorPermissionDenied:    "ErrorPermissionDenied",
	ErrorCaptcha:             "ErrorCaptcha",
	ErrorGenerateCaptcha:     "ErrorGenerateCaptcha",
	ErrorUserOrPassword:      "ErrorUserOrPassword",
	ErrorUserDisabled:        "ErrorUserDisabled",
	ErrorSession:             "ErrorSession",

	ErrorContractExist:          "ErrorContractExist",
	ErrorMarshalParameters:      "ErrorMarshalParameters",
	ErrorMarshalMethods:         "ErrorMarshalMethods",
	ErrorInstallContract:        "ErrorInstallContract",
	ErrorGetChainPolicy:         "ErrorGetChainPolicy",
	ErrorGetOrgName:             "ErrorGetOrgName",
	ErrorChainNotSub:            "ErrorChainNotSub",
	ErrorCreateVote:             "ErrorCreateVote",
	ErrorGetContract:            "ErrorGetContract",
	ErrorContractBeingVoting:    "ErrorContractBeingVoting",
	ErrorContractCanNotFreeze:   "ErrorContractCanNotFreeze",
	ErrorUpdateVotingStatus:     "ErrorUpdateVotingStatus",
	ErrorUpdateMethod:           "ErrorUpdateMethod",
	ErrorContractCanNotUnfreeze: "ErrorContractCanNotUnfreeze",
	ErrorContractCanNotRevoke:   "ErrorContractCanNotRevoke",
	ErrorContractCanNotUpgrade:  "ErrorContractCanNotUpgrade",
	ErrorRuntimeNotMatch:        "ErrorRuntimeNotMatch",
	ErrorSameContractVersion:    "ErrorSameContractVersion",
	ErrorContractNotExist:       "ErrorContractNotExist",
	ErrorAbiMethods:             "ErrorAbiMethods",
	ErrorAbiExist:               "ErrorAbiExist",
	ErrorChainNotExist:          "ErrorChainNotExist",

	ErrorGetVoteManagement: "ErrorGetVoteManagement",
	ErrorAlreadyVoted:      "ErrorAlreadyVoted",
	ErrorAlreadyOnChain:    "ErrorAlreadyOnChain",
	ErrorForbiddenPolicy:   "ErrorForbiddenPolicy",
	ErrorChainPolicy:       "ErrorChainPolicy",
	ErrorGetMessage:        "ErrorGetMessage",
	ErrorGetOrgAdminUser:   "ErrorGetOrgAdminUser",
	ErrorGetOrgClientUser:  "ErrorGetOrgClientUser",
	ErrorCreatorNotExist:   "ErrorCreatorNotExist",

	ErrorMajorityPolicy: "ErrorMajorityPolicy",

	ErrorInvokeContract:     "ErrorInvokeContract",
	ErrorCreateRecordFailed: "ErrorCreateRecordFailed",
	ErrorQueryInvokeRecord:  "ErrorQueryInvokeRecord",
	ErrorUpdateRecordFailed: "ErrorUpdateRecordFailed",
	ErrorTXNotOnChain:       "ErrorTXNotOnChain",

	ErrorChainExisted:              "ErrorChainExisted",
	ErrorCreateChain:               "ErrorCreateChain",
	ErrorGetOrg:                    "ErrorGetOrg",
	ErrorCreateChainOrg:            "ErrorCreateChainOrg",
	ErrorGetNode:                   "ErrorGetNode",
	ErrorSubscribeChain:            "ErrorSubscribeChain",
	ErrorSubscribeChainConnectNode: "ErrorSubscribeChainConnectNode",
	ErrorSubscribeChainCert:        "ErrorSubscribeChainCert",
	ErrorSubscribeChainTls:         "ErrorSubscribeChainTls",
	ErrorSubscribeChainId:          "ErrorSubscribeChainId",
	ErrorCreateChainOrgNode:        "ErrorCreateChainOrgNode",
	ErrorGetChain:                  "ErrorGetChain",
	ErrorSaveChainInfo:             "ErrorSaveChainInfo",
	ErrorDeleteChain:               "ErrorDeleteChain",
	ErrorParamBlockTxCapacity:      "ErrorParamBlockTxCapacity",
	ErrorParamBlockInterval:        "ErrorParamBlockInterval",
	ErrorParamTxTime:               "ErrorParamTxTime",
	ErrorParamChainInfo:            "ErrorParamChainInfo",
	ErrorParamTxPoolMaxSize:        "ErrorParamTxPoolMaxSize",
	ErrorParamRpcMaxMsgSize:        "ErrorParamRpcMaxMsgSize",
	ErrorParamVmMaxMsgSize:         "ErrorParamVmMaxMsgSize",
	ErrorGetAdminCert:              "ErrorGetAdminCert",
	ErrorUserNotExist:              "ErrorUserNotExist",
	ErrorSubscribeSDK:              "ErrorSubscribeSDK",

	ErrorOrgNoExisted:    "ErrorOrgNoExisted",
	ErrorCertExisted:     "ErrorCertExisted",
	ErrorGetUserTlsCert:  "ErrorGetUserTlsCert",
	ErrorGetCert:         "ErrorGetCert",
	ErrorGetOrgCaCert:    "ErrorGetOrgCaCert",
	ErrorIssueOrg:        "ErrorIssueOrg",
	ErrorCertKeyMatch:    "ErrorCertKeyMatch",
	ErrorIpFormat:        "ErrorIpFormat",
	ErrorCertContent:     "ErrorCertContent",
	ErrorAccountExisted:  "ErrorAccountExisted",
	ErrorAccountKeyMatch: "ErrorAccountKeyMatch",
	ErrorAlgorithmMatch:  "ErrorAlgorithmMatch",
	ErrorGetUserAccount:  "ErrorGetUserAccount",
	ErrorGetUserSignCert: "ErrorGetUserSignCert",
	ErrorAccountUsed:     "ErrorAccountUsed",

	ErrorCreateChainConfigPermissionUpdatePayload: "ErrorCreateChainConfigPermissionUpdatePayload",
	ErrorMergeSign:                           "ErrorMergeSign",
	ErrorUpdateChainConfig:                   "ErrorUpdateChainConfig",
	ErrorCreateChainConfigBlockUpdatePayload: "ErrorCreateChainConfigBlockUpdatePayload",
}

ErrCodeName err code name map

View Source
var (
	Log = logger.GetLogger("API")
)

Functions

func BindBody

func BindBody(ctx *gin.Context, body RequestBody) error

BindBody 绑定参数

func ConvergeDataResponse

func ConvergeDataResponse(ctx *gin.Context, data interface{}, err *Error)

ConvergeDataResponse 汇聚单一对象应答结果

func ConvergeFailureResponse

func ConvergeFailureResponse(ctx *gin.Context, errCode ErrCode)

ConvergeFailureResponse 汇聚失败应答

func ConvergeHandleErrorResponse

func ConvergeHandleErrorResponse(ctx *gin.Context, err *Error)

ConvergeHandleErrorResponse converge handle error

func ConvergeHandleFailureResponse

func ConvergeHandleFailureResponse(ctx *gin.Context, err error)

ConvergeHandleFailureResponse 汇聚处理异常的应答

func ConvergeListResponse

func ConvergeListResponse(ctx *gin.Context, datas []interface{}, count int64, err *Error)

ConvergeListResponse 汇聚集合对象应答结果

func ConvertToPbKeyValues

func ConvertToPbKeyValues(keyValues []*ParameterParams) []*pbcommon.KeyValuePair

Types

type DataResponse

type DataResponse struct {
	Data interface{}
}

DataResponse 单一对象

type DownloadResponse

type DownloadResponse struct {
	Content string
}

DownloadResponse download response

type ErrCode

type ErrCode uint32

ErrCode type

const (
	ErrCodeOK ErrCode = 0

	// 通用错误
	ErrorParamWrong    ErrCode = 10001
	ErrorHandleFailure ErrCode = 10002
	InternalError      ErrCode = 10003
	ErrorTokenNone     ErrCode = 10004
	ErrorTokenExpired  ErrCode = 10005
	ErrorTokenMismatch ErrCode = 10006

	// 用户错误处理
	ErrorUserExisted         ErrCode = 20001
	ErrorAuthFailure         ErrCode = 20002
	ErrorOldPassword         ErrCode = 20003
	ErrorOldEqualNewPassword ErrCode = 20004
	ErrorLoginOut            ErrCode = 20005
	ErrorUserNotExisted      ErrCode = 20006
	ErrorPermissionDenied    ErrCode = 20007
	ErrorCaptcha             ErrCode = 20008
	ErrorGenerateCaptcha     ErrCode = 20009
	ErrorUserOrPassword      ErrCode = 20010
	ErrorUserDisabled        ErrCode = 20011
	ErrorSession             ErrCode = 20012

	//	合约管理
	ErrorContractExist          ErrCode = 30001
	ErrorMarshalParameters      ErrCode = 30002
	ErrorInstallContract        ErrCode = 30003
	ErrorGetChainPolicy         ErrCode = 30004
	ErrorGetOrgName             ErrCode = 30005
	ErrorChainNotSub            ErrCode = 30006
	ErrorCreateVote             ErrCode = 30007
	ErrorGetContract            ErrCode = 30008
	ErrorContractBeingVoting    ErrCode = 30009
	ErrorContractCanNotFreeze   ErrCode = 30010
	ErrorUpdateVotingStatus     ErrCode = 30011
	ErrorContractCanNotUnfreeze ErrCode = 30012
	ErrorContractCanNotRevoke   ErrCode = 30013
	ErrorContractCanNotUpgrade  ErrCode = 30014
	ErrorRuntimeNotMatch        ErrCode = 30015
	ErrorSameContractVersion    ErrCode = 30016
	ErrorMarshalMethods         ErrCode = 30017
	ErrorContractNotExist       ErrCode = 30018
	ErrorUpdateMethod           ErrCode = 30019
	ErrorAbiMethods             ErrCode = 30020
	ErrorAbiExist               ErrCode = 30021
	ErrorChainNotExist          ErrCode = 30022

	// 投票管理
	ErrorGetVoteManagement ErrCode = 40001
	ErrorAlreadyVoted      ErrCode = 40002
	ErrorAlreadyOnChain    ErrCode = 40003
	ErrorForbiddenPolicy   ErrCode = 40004
	ErrorChainPolicy       ErrCode = 40005
	ErrorGetMessage        ErrCode = 40006
	ErrorGetOrgAdminUser   ErrCode = 40007
	ErrorGetOrgClientUser  ErrCode = 40008
	ErrorAdminNotImport    ErrCode = 40009
	ErrorCreatorNotExist   ErrCode = 40010

	// 概览
	ErrorMajorityPolicy ErrCode = 50001

	// 合约调用
	ErrorInvokeContract     ErrCode = 60001
	ErrorCreateRecordFailed ErrCode = 60002
	ErrorQueryInvokeRecord  ErrCode = 60003
	ErrorUpdateRecordFailed ErrCode = 60004
	ErrorTXNotOnChain       ErrCode = 60005

	//链管理
	ErrorChainExisted              ErrCode = 70001
	ErrorCreateChain               ErrCode = 70002
	ErrorGetOrg                    ErrCode = 70003
	ErrorCreateChainOrg            ErrCode = 70004
	ErrorGetNode                   ErrCode = 70005
	ErrorCreateChainOrgNode        ErrCode = 70006
	ErrorSubscribeChain            ErrCode = 70007
	ErrorSubscribeChainConnectNode ErrCode = 70008
	ErrorSubscribeChainCert        ErrCode = 70009
	ErrorSubscribeChainTls         ErrCode = 70010
	ErrorSubscribeChainId          ErrCode = 70011
	ErrorGetChain                  ErrCode = 70012
	ErrorSaveChainInfo             ErrCode = 70013
	ErrorDeleteChain               ErrCode = 70014
	ErrorGetChainSubscribe         ErrCode = 70015
	// 链参数错误
	ErrorParamBlockTxCapacity ErrCode = 70016
	ErrorParamBlockInterval   ErrCode = 70017
	ErrorParamTxTime          ErrCode = 70018
	ErrorParamChainInfo       ErrCode = 70019
	ErrorParamTxPoolMaxSize   ErrCode = 70020
	ErrorParamRpcMaxMsgSize   ErrCode = 70021
	ErrorParamVmMaxMsgSize    ErrCode = 70022
	ErrorGetAdminCert         ErrCode = 70023
	ErrorUserNotExist         ErrCode = 70024
	ErrorSubscribeSDK         ErrCode = 70025
	ErrorExplorerSubscribe    ErrCode = 70026
	ErrorExplorerUrlSubscribe ErrCode = 70027
	ErrorExplorerExist        ErrCode = 70028
	ErrorExplorerConnect      ErrCode = 70029

	//证书管咯
	ErrorOrgNoExisted    ErrCode = 80001
	ErrorGetOrgCaCert    ErrCode = 80002
	ErrorGetUserTlsCert  ErrCode = 80003
	ErrorGetCert         ErrCode = 80004
	ErrorCertExisted     ErrCode = 80005
	ErrorIssueOrg        ErrCode = 80006
	ErrorCertKeyMatch    ErrCode = 80007
	ErrorIpFormat        ErrCode = 80008
	ErrorCertContent     ErrCode = 80009
	ErrorAccountExisted  ErrCode = 80010
	ErrorAccountKeyMatch ErrCode = 80011
	ErrorAlgorithmMatch  ErrCode = 80012
	ErrorGetUserAccount  ErrCode = 80013
	ErrorGetUserSignCert ErrCode = 80014
	ErrorAccountUsed     ErrCode = 80015

	// Internal
	ErrorCreateChainConfigPermissionUpdatePayload ErrCode = 90001
	ErrorMergeSign                                ErrCode = 90002
	ErrorUpdateChainConfig                        ErrCode = 90003
	ErrorCreateChainConfigBlockUpdatePayload      ErrCode = 90004
)

nolint

func (ErrCode) String

func (e ErrCode) String() string

type Error

type Error struct {
	Code    string
	Message string
}

Error 错误

func CreateError

func CreateError(errCode ErrCode) *Error

CreateError create error

func NewError

func NewError(code, message string) *Error

NewError 创建错误

func (*Error) Error

func (e *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error Error
}

ErrorResponse 异常应答

type ExDataResponse

type ExDataResponse struct {
	Data      interface{}
	RequestId string
	Error     Error
}

ExDataResponse 单一对象

type ExplorerResponse

type ExplorerResponse struct {
	Response ExDataResponse
}

ExplorerResponse 成功的单一数据应答

type FailureResponse

type FailureResponse struct {
	Response ErrorResponse
}

FailureResponse 失败的应答

func NewFailureResponse

func NewFailureResponse(err *Error) *FailureResponse

NewFailureResponse new failure response

type InvokeContractListParams

type InvokeContractListParams struct {
	ContractName string
	// ContractAddr string
	MethodName string
	// MethodFunc   string
	Parameters []*ParameterParams
}

type ListResponse

type ListResponse struct {
	GroupList  []interface{}
	TotalCount int64
}

ListResponse 集合对象

type ListStatusResponse

type ListStatusResponse struct {
	GroupList  []interface{}
	TotalCount int64
	Status     int
	RequestId  string
}

ListStatusResponse list status response

type ParameterParams

type ParameterParams struct {
	Key   string
	Value string
}

ParameterParams parameter params

type RangeBody

type RangeBody struct {
	PageNum  int64
	PageSize int
}

RangeBody range body

func (*RangeBody) IsLegal

func (rangeBody *RangeBody) IsLegal() bool

IsLegal is legal

type RequestBody

type RequestBody interface {
	// IsLegal 是否合法
	IsLegal() bool
}

RequestBody request body

type StatusIntegerResponse

type StatusIntegerResponse struct {
	Status int
}

StatusIntegerResponse status integer response

type StatusResponse

type StatusResponse struct {
	Status string
}

StatusResponse status response

func NewStatusResponse

func NewStatusResponse() *StatusResponse

NewStatusResponse new status response

type SuccessDataResponse

type SuccessDataResponse struct {
	Response DataResponse
}

SuccessDataResponse 成功的单一数据应答

func NewSuccessDataResponse

func NewSuccessDataResponse(data interface{}) *SuccessDataResponse

NewSuccessDataResponse new success data response

type SuccessListResponse

type SuccessListResponse struct {
	Response ListResponse
}

SuccessListResponse 成功的列表数据应答

func NewSuccessListResponse

func NewSuccessListResponse(datas []interface{}, count int64) *SuccessListResponse

NewSuccessListResponse new success list response

type SuccessListStatusResponse

type SuccessListStatusResponse struct {
	Response ListStatusResponse
}

SuccessListStatusResponse 成功的状态数据应答

func NewSuccessListStatusResponse

func NewSuccessListStatusResponse(datas []interface{}, status int, count int64) *SuccessListStatusResponse

NewSuccessListStatusResponse new success list status response

type TokenResponse

type TokenResponse struct {
	Token string
}

TokenResponse token response

type UploadResponse

type UploadResponse struct {
	FileKey string
}

UploadResponse upload response

Jump to

Keyboard shortcuts

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