Documentation
¶
Index ¶
Constants ¶
View Source
const ( ConfigTypeNumFile ConfigType = iota + 1 ConfigTypeNumApollo // TODO: to be implemented ConfigTypeFile = "file" ConfigTypeApollo = "apollo" ConfigTypeEnvName = "CWGO_CONFIG_TYPE" )
View Source
const ( ProjectName = "cwgo" ServiceNameApi = ProjectName + "-" + ServerTypeApi ServiceNameAgent = ProjectName + "-" + ServerTypeAgent AgentMetadataFile = ServiceNameAgent + ".yaml" ServerRunModeStandalone = "standalone" ServerRunModeCluster = "cluster" )
View Source
const ( TempDirRepo = "repo" // repo pull file temp dir TempDirGeneratedCode = "generated_code" // generated code temp dir )
View Source
const ( ErrNumParam = iota + 10000 ErrNumParamOrderNum ErrNumParamOrderBy ErrNumParamRepositoryType ErrNumParamStoreType ErrNumParamRepositoryUrl ErrNumParamDomain ErrNumParamMainIdlPath ErrNumParamTemplateType ErrNumParamUrl ErrNumParamRepositoryStatus ErrNumParamRepositoryBranch ErrNumParamIdlStatus )
params err
View Source
const ( ErrMsgParam = "param err" ErrMsgParamOrderNum = "invalid order num" ErrMsgParamOrderBy = "invalid order by" ErrMsgParamRepositoryType = "invalid repository type" ErrMsgParamStoreType = "invalid store type" ErrMsgParamRepositoryUrl = "invalid repository url" ErrMsgParamDomain = "invalid domain" ErrMsgParamMainIdlPath = "invalid main idl path" ErrMsgParamTemplateType = "invalid template type" ErrMsgParamUrl = "invalid url" ErrMsgParamRepositoryStatus = "invalid repository status" ErrMsgParamRepositoryBranch = "invalid repository branch" ErrMsgParamIdlStatus = "invalid idl status" )
View Source
const ( ErrNumRpc = iota + 20000 ErrNumRpcGetClient ErrNumRpcConnectClient )
rpc err
View Source
const ( ErrMsgRpc = "rpc err" ErrMsgRpcGetClient = "get rpc client failed" ErrMsgRpcConnectClient = "connect to rpc client failed" )
View Source
const ( ErrNumDatabase = iota + 30000 ErrNumDatabaseRecordNotFound ErrNumDatabaseDuplicateRecord )
View Source
const ( ErrMsgDatabase = "database err" ErrMsgDatabaseRecordNotFound = "record not found" ErrMsgDatabaseDuplicateRecord = "duplicate record" )
View Source
const ( ErrNumToken = iota + 40000 ErrNumTokenInvalid ErrNumTokenInvalidType )
View Source
const ( ErrMsgToken = "token err" ErrMsgTokenInvalid = "token is invalid" ErrMsgTokenInvalidType = "invalid token type" )
View Source
const ( ErrNumIdl = iota + 50000 ErrNumIdlAlreadyExist ErrNumIdlFileExtension ErrNumIdlGetDependentFilePath )
View Source
const ( ErrMsgIdl = "idl err" ErrMsgIdlAlreadyExist = "idl is already exist" ErrMsgIdlFileExtension = "invalid idl file extension" ErrMsgIdlGetDependentFilePath = "get dependent file paths from idl failed" )
View Source
const ( ErrNumRepo = iota + 60000 ErrNumRepoGetFile ErrNumRepoGetCommitHash ErrNumRepoGetArchive ErrNumRepoParseArchive ErrNumRepoGetPrivacy ErrNumRepoCreate ErrNumRepoGetClient ErrNumRepoPush ErrNumRepoValidateBranch )
View Source
const ( ErrMsgRepo = "repo err" ErrMsgRepoGetFile = "get file from repo failed" ErrMsgRepoGetCommitHash = "get commit hash failed" ErrMsgRepoGetArchive = "get repo archive failed" ErrMsgRepoParseArchive = "parse repo archive failed" ErrMsgRepoGetPrivacy = "get repo privacy failed" ErrMsgRepoCreate = "create repo failed" ErrMsgRepoGetClient = "get repo client failed" ErrMsgRepoPush = "push files to repo failed" ErrMsgRepoValidateBranch = "validate repo branch failed" )
View Source
const ( ErrNumCommon = iota + 70000 ErrNumCommonCreateTempDir ErrNumCommonGenerateCode ErrNumCommonProcessFolders ErrNumCommonMkdir ErrNumCommonRepoApiService )
View Source
const ( ErrMsgCommon = "common err" ErrMsgCommonCreateTempDir = "create temp dir failed" ErrMsgCommonGenerateCode = "generate code failed" ErrMsgCommonProcessFolders = "process folders failed" ErrMsgCommonMkdir = "mkdir failed" ErrMsgCommonRepoApiService = "repo api service is down" )
View Source
const ( IdlTypeNumThrift = iota + 1 IdlTypeNumProto )
View Source
const ( IdlStatusNumInactive = iota + 1 IdlStatusNumActive )
View Source
const ( OrderNumInc = 0 OrderNumDec = 1 OrderInc = "asc" OrderDec = "desc" OrderByUpdateTime = "update_time" )
View Source
const ( MainRef = "main" GitHubDomain = "github.com" GitLabDomain = "gitlab.com" GithubURLPrefix = "https://github.com/" )
View Source
const ( RepositoryTypeNumGitLab = iota + 1 RepositoryTypeNumGithub RepositoryTypeNum = iota )
View Source
const ( RepositoryStoreTypeNumIdl = iota + 1 RepositoryStoreTypeNumService RepositoryStoreTypeNum = iota )
View Source
const ( RepositoryStatusNumInactive = iota + 1 RepositoryStatusNumActive )
View Source
const ( TemplateTypeNumHz = iota + 1 TemplateTypeNumKitex )
View Source
const ( TemplateHzTplTypeLayout = "layout.yaml" TemplateHzTplTypeRenderData = "render_data.json" TemplateHzTplTypePackage = "package.yaml" )
View Source
const ( TokenStatusNumExpired = iota + 1 TokenStatusNumValid )
View Source
const ( TokenTypeNumPersonal = iota + 1 TokenTypeNumOrganization )
View Source
const ( ServerTypeNumApi ServerType = iota + 1 ServerTypeNumAgent ServerTypeApi = "api" ServerTypeAgent = "agent" ServerTypeEnvName = "CWGO_SERVER_TYPE" )
View Source
const ( ServerModeNumDev ServerMode = iota + 1 ServerModeNumPro ServerModeDev = "dev" ServerModePro = "prod" )
View Source
const ( RegistryTypeNumBuiltin RegistryType = iota + 1 RegistryTypeNumConsul RegistryTypeBuiltin = "builtin" RegistryTypeConsul = "consul" )
View Source
const ( StoreTypeNumMysql StoreType = iota + 1 StoreTypeNumMongo StoreTypeNumRedis StoreTypeMysql = "mysql" StoreTypeMongo = "mongo" StoreTypeRedis = "redis" )
View Source
const ( StaticFileDefaultPath = "./dist" StaticFilePathEnvName = "CWGO_STATIC_FILE_PATH" )
View Source
const (
ConfigDefaultPath = ""
)
View Source
const (
ConfigPathEnvName = "CWGO_CONFIG_PATH"
)
View Source
const (
DefaultLimit = 20
)
View Source
const (
RdbKeyRegistryService = ProjectName + ":" + "registry:service:%s"
)
View Source
const ServiceID = "service_id"
Variables ¶
View Source
var ( ProxyUrl string TimeZone *time.Location )
View Source
var ( ConfigTypeMapToStr = map[ConfigType]string{ ConfigTypeNumFile: ConfigTypeFile, ConfigTypeNumApollo: ConfigTypeApollo, } ConfigTypeMapToNum = map[string]ConfigType{ ConfigTypeFile: ConfigTypeNumFile, ConfigTypeApollo: ConfigTypeNumApollo, } )
View Source
var ( ErrParam = errx.New(ErrNumParam, ErrMsgParam) ErrParamOrderNum = errx.New(ErrNumParamOrderNum, ErrMsgParamOrderNum) ErrParamOrderBy = errx.New(ErrNumParamOrderBy, ErrMsgParamOrderBy) ErrParamRepositoryType = errx.New(ErrNumParamRepositoryType, ErrMsgParamRepositoryType) ErrParamRepositoryUrl = errx.New(ErrNumParamStoreType, ErrMsgParamRepositoryUrl) ErrParamDomain = errx.New(ErrNumParamDomain, ErrMsgParamDomain) ErrParamMainIdlPath = errx.New(ErrNumParamMainIdlPath, ErrMsgParamMainIdlPath) ErrParamTemplateType = errx.New(ErrNumParamTemplateType, ErrMsgParamTemplateType) ErrParamUrl = errx.New(ErrNumParamUrl, ErrMsgParamUrl) ErrParamRepositoryStatus = errx.New(ErrNumParamRepositoryStatus, ErrMsgParamRepositoryStatus) ErrParamRepositoryBranch = errx.New(ErrNumParamRepositoryBranch, ErrMsgParamRepositoryBranch) )
View Source
var ( ErrRpc = errx.New(ErrNumRpc, ErrMsgRpc) ErrRpcGetClient = errx.New(ErrNumRpcGetClient, ErrMsgRpcGetClient) ErrRpcConnectClient = errx.New(ErrNumRpcConnectClient, ErrMsgRpcConnectClient) )
View Source
var ( ErrDatabase = errx.New(ErrNumDatabase, ErrMsgDatabase) ErrDatabaseRecordNotFound = errx.New(ErrNumDatabaseRecordNotFound, ErrMsgDatabaseRecordNotFound) ErrDatabaseDuplicateRecord = errx.New(ErrNumDatabaseDuplicateRecord, ErrMsgDatabaseDuplicateRecord) )
View Source
var ( ErrToken = errx.New(ErrNumToken, ErrMsgToken) ErrTokenInvalid = errx.New(ErrNumTokenInvalid, ErrMsgTokenInvalid) ErrTokenInvalidType = errx.New(ErrNumTokenInvalidType, ErrMsgTokenInvalidType) )
View Source
var ( ErrIdl = errx.New(ErrNumIdl, ErrMsgIdl) ErrIdlAlreadyExist = errx.New(ErrNumIdlAlreadyExist, ErrMsgIdlAlreadyExist) ErrIdlFileExtension = errx.New(ErrNumIdlFileExtension, ErrMsgIdlFileExtension) ErrIdlGetDependentFilePath = errx.New(ErrNumIdlGetDependentFilePath, ErrMsgIdlGetDependentFilePath) )
View Source
var ( ErrRepo = errx.New(ErrNumRepo, ErrMsgRepo) ErrRepoGetFile = errx.New(ErrNumRepoGetFile, ErrMsgRepoGetFile) ErrRepoGetCommitHash = errx.New(ErrNumRepoGetCommitHash, ErrMsgRepoGetCommitHash) ErrRepoGetArchive = errx.New(ErrNumRepoGetArchive, ErrMsgRepoGetArchive) ErrRepoParseArchive = errx.New(ErrNumRepoParseArchive, ErrMsgRepoParseArchive) ErrRepoGetPrivacy = errx.New(ErrNumRepoGetPrivacy, ErrMsgRepoGetPrivacy) ErrRepoCreate = errx.New(ErrNumRepoCreate, ErrMsgRepoCreate) ErrRepoGetClient = errx.New(ErrNumRepoGetClient, ErrMsgRepoGetClient) ErrRepoPush = errx.New(ErrNumRepoPush, ErrMsgRepoPush) ErrRepoValidateBranch = errx.New(ErrNumRepoValidateBranch, ErrMsgRepoValidateBranch) )
View Source
var ( ErrCommon = errx.New(ErrNumCommon, ErrMsgCommon) ErrCommonCreateTempDir = errx.New(ErrNumCommonCreateTempDir, ErrMsgCommonCreateTempDir) ErrCommonGenerateCode = errx.New(ErrNumCommonGenerateCode, ErrMsgCommonGenerateCode) ErrCommonProcessFolders = errx.New(ErrNumCommonProcessFolders, ErrMsgCommonProcessFolders) ErrCommonMkdir = errx.New(ErrNumCommonMkdir, ErrMsgCommonMkdir) ErrCommonRepoApiService = errx.New(ErrNumCommonRepoApiService, ErrMsgCommonRepoApiService) )
View Source
var ( ServerModeMapToStr = map[ServerMode]string{ ServerModeNumDev: ServerModeDev, ServerModeNumPro: ServerModePro, } ServerModeMapToNum = map[string]ServerMode{ ServerModeDev: ServerModeNumDev, ServerModePro: ServerModeNumPro, } )
View Source
var DispatcherMapToNum = map[string]DispatcherType{ DispatcherTypeHash: DispatcherTypeNumHash, }
View Source
var IdlStatusNumMap = map[int]struct{}{ IdlStatusNumActive: {}, IdlStatusNumInactive: {}, }
View Source
var IdlTypeNumMap = map[int]struct{}{ IdlTypeNumThrift: {}, IdlTypeNumProto: {}, }
View Source
var RegistryTypeMapToNum = map[string]RegistryType{ RegistryTypeBuiltin: RegistryTypeNumBuiltin, RegistryTypeConsul: RegistryTypeNumConsul, }
View Source
var RepositoryStatusNumMap = map[int]struct{}{ RepositoryStatusNumActive: {}, RepositoryStatusNumInactive: {}, }
View Source
var RepositoryTypeNumMap = map[int]struct{}{ RepositoryTypeNumGitLab: {}, RepositoryTypeNumGithub: {}, }
View Source
var ServerTypeMapToStr = map[ServerType]string{ ServerTypeNumApi: ServerTypeApi, ServerTypeNumAgent: ServerTypeAgent, }
View Source
var StoreTypeMapToNum = map[string]StoreType{ StoreTypeMysql: StoreTypeNumMysql, StoreTypeMongo: StoreTypeNumMongo, StoreTypeRedis: StoreTypeNumRedis, }
View Source
var TempDir string
View Source
var TemplateHzTplTypeMap = map[string]struct{}{ TemplateHzTplTypeLayout: {}, TemplateHzTplTypeRenderData: {}, TemplateHzTplTypePackage: {}, }
View Source
var TemplateTypeNumMap = map[int]struct{}{ TemplateTypeNumHz: {}, TemplateTypeNumKitex: {}, }
View Source
var TokenStatusNumMap = map[int32]struct{}{ TokenStatusNumExpired: {}, TokenStatusNumValid: {}, }
View Source
var TokenTypeNumMap = map[int32]struct{}{ TokenTypeNumPersonal: {}, TokenTypeNumOrganization: {}, }
Functions ¶
This section is empty.
Types ¶
type ConfigType ¶
type ConfigType uint32
type DispatcherType ¶
type DispatcherType uint32
const ( DispatcherTypeNumHash DispatcherType = iota + 1 DispatcherTypeHash = "consistent-hash" )
type RegistryType ¶
type RegistryType uint32
type ServerMode ¶
type ServerMode uint32
type ServerType ¶
type ServerType uint32
Click to show internal directories.
Click to hide internal directories.