Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baetyl-979 public ParseListOptions and ParseListOptionsAppendSystemLabel #308

Merged
merged 1 commit into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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