Skip to content

Commit

Permalink
golint
Browse files Browse the repository at this point in the history
  • Loading branch information
linfang-canway committed Oct 31, 2023
1 parent 0e7f15d commit ae73449
Showing 1 changed file with 10 additions and 40 deletions.
50 changes: 10 additions & 40 deletions bcs-services/bcs-bscp/pkg/types/kv.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
Tencent is pleased to support the open source community by making Basic Service Configuration Platform available.
Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.
*/
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

package types

Expand All @@ -21,36 +21,6 @@ import (
"gopkg.in/yaml.v3"
)

// ListKvOption defines options to list kv.
type ListKvOption struct {
BizID uint32 `json:"biz_id"`
AppID uint32 `json:"app_id"`
Name string `json:"name"`
ID uint32 `json:"id"`
SearchKey string `json:"search_key"`
All bool `json:"all"`
Page *BasePage `json:"page"`
}

func (opt *ListKvOption) Validate(po *PageOption) error {
if opt.BizID <= 0 {
return errors.New("invalid biz id, should >= 1")
}
if opt.AppID <= 0 {
return errors.New("invalid app id, should >= 1")
}

if opt.Page == nil {
return errors.New("page is null")
}

if err := opt.Page.Validate(po); err != nil {
return err
}

return nil
}

// KvType is the type of kv
type KvType string

Expand Down

0 comments on commit ae73449

Please sign in to comment.