diff --git a/database/gdb/gdb.go b/database/gdb/gdb.go index c6da50bba..89f02b799 100644 --- a/database/gdb/gdb.go +++ b/database/gdb/gdb.go @@ -384,9 +384,9 @@ const ( type queryType int const ( - queryTypeNormal queryType = 0 - queryTypeCount queryType = 1 - queryTypeValue queryType = 2 + queryTypeNormal queryType = iota + queryTypeCount + queryTypeValue ) type joinOperator string @@ -400,14 +400,17 @@ const ( type InsertOption int const ( - InsertOptionDefault InsertOption = 0 - InsertOptionReplace InsertOption = 1 - InsertOptionSave InsertOption = 2 - InsertOptionIgnore InsertOption = 3 - InsertOperationInsert = "INSERT" - InsertOperationReplace = "REPLACE" - InsertOperationIgnore = "INSERT IGNORE" - InsertOnDuplicateKeyUpdate = "ON DUPLICATE KEY UPDATE" + InsertOptionDefault InsertOption = iota + InsertOptionReplace + InsertOptionSave + InsertOptionIgnore +) + +const ( + InsertOperationInsert = "INSERT" + InsertOperationReplace = "REPLACE" + InsertOperationIgnore = "INSERT IGNORE" + InsertOnDuplicateKeyUpdate = "ON DUPLICATE KEY UPDATE" ) const ( diff --git a/net/ghttp/ghttp_request_param.go b/net/ghttp/ghttp_request_param.go index cf232c4d7..20f67d2ef 100644 --- a/net/ghttp/ghttp_request_param.go +++ b/net/ghttp/ghttp_request_param.go @@ -30,9 +30,9 @@ import ( ) const ( - parseTypeRequest = 0 - parseTypeQuery = 1 - parseTypeForm = 2 + parseTypeRequest = iota + parseTypeQuery + parseTypeForm ) var ( diff --git a/net/ghttp/ghttp_server_config.go b/net/ghttp/ghttp_server_config.go index 4d3355f7b..22163051e 100644 --- a/net/ghttp/ghttp_server_config.go +++ b/net/ghttp/ghttp_server_config.go @@ -33,10 +33,14 @@ import ( const ( defaultHttpAddr = ":80" // Default listening port for HTTP. defaultHttpsAddr = ":443" // Default listening port for HTTPS. - UriTypeDefault = 0 // Method names to the URI converting type, which converts name to its lower case and joins the words using char '-'. - UriTypeFullName = 1 // Method names to the URI converting type, which does not convert to the method name. - UriTypeAllLower = 2 // Method names to the URI converting type, which converts name to its lower case. - UriTypeCamel = 3 // Method names to the URI converting type, which converts name to its camel case. + +) + +const ( + UriTypeDefault = iota // Method names to the URI converting type, which converts name to its lower case and joins the words using char '-'. + UriTypeFullName // Method names to the URI converting type, which does not convert to the method name. + UriTypeAllLower // Method names to the URI converting type, which converts name to its lower case. + UriTypeCamel // Method names to the URI converting type, which converts name to its camel case. ) // ServerConfig is the HTTP Server configuration manager. diff --git a/net/gtcp/gtcp_conn_pkg.go b/net/gtcp/gtcp_conn_pkg.go index 0be97faec..797baa92e 100644 --- a/net/gtcp/gtcp_conn_pkg.go +++ b/net/gtcp/gtcp_conn_pkg.go @@ -15,8 +15,9 @@ import ( ) const ( - pkgHeaderSizeDefault = 2 // Header size for simple package protocol. - pkgHeaderSizeMax = 4 // Max header size for simple package protocol. + _ = iota << 1 + pkgHeaderSizeDefault // Header size for simple package protocol. + pkgHeaderSizeMax // Max header size for simple package protocol. ) // PkgOption is package option for simple protocol. diff --git a/net/gtcp/gtcp_pool.go b/net/gtcp/gtcp_pool.go index eac95212a..5d4135bb6 100644 --- a/net/gtcp/gtcp_pool.go +++ b/net/gtcp/gtcp_pool.go @@ -21,11 +21,12 @@ type PoolConn struct { status int // Status of current connection, which is used to mark this connection usable or not. } +const defaultPoolExpire = 10 * time.Second // Default TTL for connection in the pool. + const ( - defaultPoolExpire = 10 * time.Second // Default TTL for connection in the pool. - connStatusUnknown = 0 // Means it is unknown it's connective or not. - connStatusActive = 1 // Means it is now connective. - connStatusError = 2 // Means it should be closed and removed from pool. + connStatusUnknown = iota // Means it is unknown it's connective or not. + connStatusActive // Means it is now connective. + connStatusError // Means it should be closed and removed from pool. ) var (