Documentation ¶
Overview ¶
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * 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.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * 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.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * 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.
Index ¶
- func InitStore(schema gjson.Result, key HubKey, opt GenericStoreOption) error
- func InitStores(schema gjson.Result, conf storage.EtcdConfig, ...) error
- func RangeStore(f func(key HubKey, store *GenericStore) bool)
- type APISIXJsonSchemaValidator
- type APISIXSchemaValidator
- type GenericStore
- func (s *GenericStore) BatchDelete(ctx context.Context, keys []string) error
- func (s *GenericStore) Close() error
- func (s *GenericStore) Create(ctx context.Context, obj interface{}) (interface{}, error)
- func (s *GenericStore) CreateCheck(obj interface{}) ([]byte, error)
- func (s *GenericStore) Get(_ context.Context, key string) (interface{}, error)
- func (s *GenericStore) GetObjStorageKey(obj interface{}) string
- func (s *GenericStore) GetStorageKey(key string) string
- func (s *GenericStore) Init() error
- func (s *GenericStore) List(_ context.Context, input ListInput) (*ListOutput, error)
- func (s *GenericStore) Range(_ context.Context, f func(key string, obj interface{}) bool)
- func (s *GenericStore) StringToObjPtr(str, key string) (interface{}, error)
- func (s *GenericStore) Type() HubKey
- func (s *GenericStore) Update(ctx context.Context, obj interface{}, createIfNotExist bool) (interface{}, error)
- type GenericStoreOption
- type HubKey
- type Interface
- type JsonSchemaValidator
- type ListInput
- type ListOutput
- type MockInterface
- func (m *MockInterface) BatchDelete(ctx context.Context, keys []string) error
- func (m *MockInterface) Create(ctx context.Context, obj interface{}) (interface{}, error)
- func (m *MockInterface) Get(_ context.Context, key string) (interface{}, error)
- func (m *MockInterface) List(_ context.Context, input ListInput) (*ListOutput, error)
- func (m *MockInterface) Type() HubKey
- func (m *MockInterface) Update(ctx context.Context, obj interface{}, createOnFail bool) (interface{}, error)
- type MockValidator
- type Pagination
- type Validator
- func NewAPISIXJsonSchemaValidator(schema gjson.Result, jsonPath string) (Validator, error)
- func NewAPISIXSchemaValidator(schema gjson.Result, jsonPath string) (Validator, error)
- func NewJsonSchemaValidator(jsonPath string) (Validator, error)
- func NewSchemaValidator(schemaJson string) (Validator, error)
- type WatchEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitStores ¶
func InitStores(schema gjson.Result, conf storage.EtcdConfig, watchEvents map[HubKey]WatchEvent) error
func RangeStore ¶
func RangeStore(f func(key HubKey, store *GenericStore) bool)
Types ¶
type APISIXJsonSchemaValidator ¶
type APISIXJsonSchemaValidator struct {
// contains filtered or unexported fields
}
func (*APISIXJsonSchemaValidator) Validate ¶
func (v *APISIXJsonSchemaValidator) Validate(obj interface{}) error
type APISIXSchemaValidator ¶
type APISIXSchemaValidator struct {
// contains filtered or unexported fields
}
func (*APISIXSchemaValidator) Validate ¶
func (v *APISIXSchemaValidator) Validate(obj interface{}) error
type GenericStore ¶
func GetStore ¶
func GetStore(key HubKey) *GenericStore
func NewGenericStore ¶
func NewGenericStore(opt GenericStoreOption) (*GenericStore, error)
func (*GenericStore) BatchDelete ¶
func (s *GenericStore) BatchDelete(ctx context.Context, keys []string) error
func (*GenericStore) Close ¶
func (s *GenericStore) Close() error
func (*GenericStore) Create ¶
func (s *GenericStore) Create(ctx context.Context, obj interface{}) (interface{}, error)
func (*GenericStore) CreateCheck ¶
func (s *GenericStore) CreateCheck(obj interface{}) ([]byte, error)
func (*GenericStore) Get ¶
func (s *GenericStore) Get(_ context.Context, key string) (interface{}, error)
func (*GenericStore) GetObjStorageKey ¶
func (s *GenericStore) GetObjStorageKey(obj interface{}) string
func (*GenericStore) GetStorageKey ¶
func (s *GenericStore) GetStorageKey(key string) string
func (*GenericStore) Init ¶
func (s *GenericStore) Init() error
func (*GenericStore) List ¶
func (s *GenericStore) List(_ context.Context, input ListInput) (*ListOutput, error)
func (*GenericStore) Range ¶
func (s *GenericStore) Range(_ context.Context, f func(key string, obj interface{}) bool)
func (*GenericStore) StringToObjPtr ¶
func (s *GenericStore) StringToObjPtr(str, key string) (interface{}, error)
func (*GenericStore) Type ¶
func (s *GenericStore) Type() HubKey
type GenericStoreOption ¶
type HubKey ¶
type HubKey string
const ( HubKeyConsumer HubKey = "consumer" HubKeyRoute HubKey = "route" HubKeyService HubKey = "service" HubKeySsl HubKey = "ssl" HubKeyUpstream HubKey = "upstream" HubKeyScript HubKey = "script" HubKeyGlobalRule HubKey = "global_rule" HubKeyServerInfo HubKey = "server_info" HubKeyPluginConfig HubKey = "plugin_config" HubKeyProto HubKey = "proto" HubKeyStreamRoute HubKey = "stream_route" )
type Interface ¶
type Interface interface { Type() HubKey Get(ctx context.Context, key string) (interface{}, error) // 通过key查询 List(ctx context.Context, input ListInput) (*ListOutput, error) // 查询list Create(ctx context.Context, obj interface{}) (interface{}, error) // 创建 Update(ctx context.Context, obj interface{}, createIfNotExist bool) (interface{}, error) // 更新 BatchDelete(ctx context.Context, keys []string) error // 批量删除 }
type JsonSchemaValidator ¶
type JsonSchemaValidator struct {
// contains filtered or unexported fields
}
func (*JsonSchemaValidator) Validate ¶
func (v *JsonSchemaValidator) Validate(obj interface{}) error
type ListOutput ¶
type ListOutput struct { Rows []interface{} `json:"rows"` TotalSize int `json:"total_size"` }
func NewListOutput ¶
func NewListOutput() *ListOutput
NewListOutput returns JSON marshalling safe struct pointer for empty slice
type MockInterface ¶
func (*MockInterface) BatchDelete ¶
func (m *MockInterface) BatchDelete(ctx context.Context, keys []string) error
func (*MockInterface) Create ¶
func (m *MockInterface) Create(ctx context.Context, obj interface{}) (interface{}, error)
func (*MockInterface) Get ¶
func (m *MockInterface) Get(_ context.Context, key string) (interface{}, error)
func (*MockInterface) List ¶
func (m *MockInterface) List(_ context.Context, input ListInput) (*ListOutput, error)
func (*MockInterface) Type ¶
func (m *MockInterface) Type() HubKey
type MockValidator ¶
MockValidator is an autogenerated mock type for the Validator type
func (*MockValidator) Validate ¶
func (_m *MockValidator) Validate(obj interface{}) error
Validate provides a mock function with given fields: obj
type Pagination ¶
type Validator ¶
type Validator interface {
Validate(obj interface{}) error
}