Skip to content

Commit

Permalink
baetyl-979 public ParseListOptions and ParseListOptionsAppendSystemLa…
Browse files Browse the repository at this point in the history
…bel (#308)
  • Loading branch information
zxxf18 authored Apr 27, 2021
1 parent 15bdde6 commit 5cb6136
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (api *API) GetApplication(c *common.Context) (interface{}, error) {
// ListApplication list application
func (api *API) ListApplication(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptionsAppendSystemLabel(c)
params, err := api.ParseListOptionsAppendSystemLabel(c)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -317,16 +317,16 @@ func (api *API) getBaseAppIfSet(c *common.Context) (*specV1.Application, error)
return nil, nil
}

func (api *API) parseListOptions(c *common.Context) (*models.ListOptions, error) {
func (api *API) ParseListOptions(c *common.Context) (*models.ListOptions, error) {
params := &models.ListOptions{}
if err := c.Bind(params); err != nil {
return nil, err
}
return params, nil
}

func (api *API) parseListOptionsAppendSystemLabel(c *common.Context) (*models.ListOptions, error) {
opt, err := api.parseListOptions(c)
func (api *API) ParseListOptionsAppendSystemLabel(c *common.Context) (*models.ListOptions, error) {
opt, err := api.ParseListOptions(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (api *API) GetCertificate(c *common.Context) (interface{}, error) {
// ListCertificate list Certificate
func (api *API) ListCertificate(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptionsAppendSystemLabel(c)
params, err := api.ParseListOptionsAppendSystemLabel(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (api *API) GetConfig(c *common.Context) (interface{}, error) {
// ListConfig list config
func (api *API) ListConfig(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptionsAppendSystemLabel(c)
params, err := api.ParseListOptionsAppendSystemLabel(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (api *API) GetNodeStats(c *common.Context) (interface{}, error) {
// ListNode list node
func (api *API) ListNode(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptions(c)
params, err := api.ParseListOptions(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (api *API) GetRegistry(c *common.Context) (interface{}, error) {
// ListRegistry list Registry
func (api *API) ListRegistry(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptionsAppendSystemLabel(c)
params, err := api.ParseListOptionsAppendSystemLabel(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (api *API) GetSecret(c *common.Context) (interface{}, error) {
// ListSecret list secret
func (api *API) ListSecret(c *common.Context) (interface{}, error) {
ns := c.GetNamespace()
params, err := api.parseListOptionsAppendSystemLabel(c)
params, err := api.ParseListOptionsAppendSystemLabel(c)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions plugin/database/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func (d *DB) RefreshIndex(tx interface{}, namespace string, keyA, keyB common.Re
}
if len(res) > 0 {
if _, err = d.DeleteIndexTx(transaction, namespace, keyB, keyA, valueA); err != nil {
return err
}
return err
}
}
for _, b := range valueBs {
if _, err = d.CreateIndexTx(transaction, namespace, keyA, keyB, valueA, b); err != nil {
return err
}
return err
}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/default/transaction/default_tx_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func init() {
plugin.RegisterFactory("defaulttx", New)
}

type defaultTxFactory struct {}
type defaultTxFactory struct{}

func New() (plugin.Plugin, error) {
return &defaultTxFactory{}, nil
Expand Down
2 changes: 1 addition & 1 deletion service/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

//go:generate mockgen -destination=../mock/service/wrapper.go -package=service github.com/baetyl/baetyl-cloud/v2/service WrapperService

type CreateNodeFunc func (tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error)
type CreateNodeFunc func(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error)

type WrapperService interface {
CreateNodeTx(CreateNodeFunc) CreateNodeFunc
Expand Down

0 comments on commit 5cb6136

Please sign in to comment.