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:
Regan Yue 2022-07-19 17:17:06 +08:00 committed by GitHub
parent 80e6f3d42c
commit 907956fbcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 11 deletions

View File

@ -12,6 +12,6 @@
// See the License for the specific language governing permissions and
// 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
package bean

View File

@ -25,7 +25,7 @@ import (
// code, msg
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 {
return fmt.Errorf(errFmt, c.Code(), msg)
}

View File

@ -53,20 +53,20 @@ import (
// Configer defines how to get and set value from configuration raw data.
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
// 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)
// get string slice
// Strings get string slice
Strings(key string) ([]string, error)
Int(key string) (int, error)
Int64(key string) (int64, error)
Bool(key string) (bool, 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
// get string slice
// DefaultStrings get string slice
DefaultStrings(key string, defaultVal []string) []string
DefaultInt(key string, defaultVal int) int
DefaultInt64(key string, defaultVal int64) int64

View File

@ -19,8 +19,6 @@ import (
"os"
"strings"
"github.com/pelletier/go-toml"
"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
func (c *configContainer) Bool(key string) (bool, error) {
res, err := c.get(key)

View File

@ -19,7 +19,7 @@ import (
"time"
)
// short string format
// ToShortTimeFormat short string format
func ToShortTimeFormat(d time.Duration) string {
u := uint64(d)
if u < uint64(time.Second) {