|
- package flags
-
- import "errors"
-
- const (
- // CacheAlterTable is 修改表缓存名
- CacheAlterTable string = "db_center_alter_table"
- // CacheUserMigrate is 用户迁移
- CacheUserMigrate string = "user_migrate"
- )
-
- // BoolFlag is type of map[string]bool
- type BoolFlag map[string]bool
-
- // BoolFlagMap is mapping bool
- var BoolFlagMap = BoolFlag{
- "1": true,
- "true": true,
- "True": true,
- "0": false,
- "false": false,
- "False": false,
- }
-
- // BoundCheck is return false and err if is not found
- func (b BoolFlag) BoundCheck(flag string) (bool, error) {
- bl, ok := b[flag]
- if !ok {
- return false, errors.New("Flag Not Mapping Any Key")
- }
- return bl, nil
- }
-
- // Check is not found return flase
- func (b BoolFlag) Check(flag string) bool {
- bl, ok := b[flag]
- if !ok {
- return false
- }
- return bl
- }
|