refine comments for package core (#5014)
* Refine Comments * refine comments for cache.go * refine comments for log.go * Update orm.go * refine comments for orm_log.go,types.go * Update utils.go * Update doc.go * refine comments * refine comments * Update db.go * refine comments for core
This commit is contained in:
parent
80e6f3d42c
commit
907956fbcf
@ -12,6 +12,6 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// bean is a basic package
|
// Package bean is a basic package
|
||||||
// it should not depend on other modules except common module, log module and config module
|
// it should not depend on other modules except common module, log module and config module
|
||||||
package bean
|
package bean
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import (
|
|||||||
// code, msg
|
// code, msg
|
||||||
const errFmt = "ERROR-%d, %s"
|
const errFmt = "ERROR-%d, %s"
|
||||||
|
|
||||||
// Err returns an error representing c and msg. If c is OK, returns nil.
|
// Error returns an error representing c and msg. If c is OK, returns nil.
|
||||||
func Error(c Code, msg string) error {
|
func Error(c Code, msg string) error {
|
||||||
return fmt.Errorf(errFmt, c.Code(), msg)
|
return fmt.Errorf(errFmt, c.Code(), msg)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,20 +53,20 @@ import (
|
|||||||
|
|
||||||
// Configer defines how to get and set value from configuration raw data.
|
// Configer defines how to get and set value from configuration raw data.
|
||||||
type Configer interface {
|
type Configer interface {
|
||||||
// support section::key type in given key when using ini type.
|
// Set support section::key type in given key when using ini type.
|
||||||
Set(key, val string) error
|
Set(key, val string) error
|
||||||
|
|
||||||
// support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
// String support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||||
String(key string) (string, error)
|
String(key string) (string, error)
|
||||||
// get string slice
|
// Strings get string slice
|
||||||
Strings(key string) ([]string, error)
|
Strings(key string) ([]string, error)
|
||||||
Int(key string) (int, error)
|
Int(key string) (int, error)
|
||||||
Int64(key string) (int64, error)
|
Int64(key string) (int64, error)
|
||||||
Bool(key string) (bool, error)
|
Bool(key string) (bool, error)
|
||||||
Float(key string) (float64, error)
|
Float(key string) (float64, error)
|
||||||
// support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
// DefaultString support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||||
DefaultString(key string, defaultVal string) string
|
DefaultString(key string, defaultVal string) string
|
||||||
// get string slice
|
// DefaultStrings get string slice
|
||||||
DefaultStrings(key string, defaultVal []string) []string
|
DefaultStrings(key string, defaultVal []string) []string
|
||||||
DefaultInt(key string, defaultVal int) int
|
DefaultInt(key string, defaultVal int) int
|
||||||
DefaultInt64(key string, defaultVal int64) int64
|
DefaultInt64(key string, defaultVal int64) int64
|
||||||
|
|||||||
@ -19,8 +19,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/pelletier/go-toml"
|
|
||||||
|
|
||||||
"github.com/beego/beego/v2/core/config"
|
"github.com/beego/beego/v2/core/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -135,7 +133,7 @@ func (c *configContainer) Int64(key string) (int64, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool return bool value
|
// Bool return bool value
|
||||||
// return error if key not found or value is invalid type
|
// return error if key not found or value is invalid type
|
||||||
func (c *configContainer) Bool(key string) (bool, error) {
|
func (c *configContainer) Bool(key string) (bool, error) {
|
||||||
res, err := c.get(key)
|
res, err := c.get(key)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// short string format
|
// ToShortTimeFormat short string format
|
||||||
func ToShortTimeFormat(d time.Duration) string {
|
func ToShortTimeFormat(d time.Duration) string {
|
||||||
u := uint64(d)
|
u := uint64(d)
|
||||||
if u < uint64(time.Second) {
|
if u < uint64(time.Second) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user