Documentation
¶
Index ¶
- Constants
- func NewSqliteStore(connString string) (*sqliteStore, error)
- type Filter
- type Ordering
- type OrderingField
- type Pagination
- type Store
- type StoreMock
- func (mock *StoreMock) CreateAPI(a model.API) (model.API, error)
- func (mock *StoreMock) CreateAPICalls() []struct{ ... }
- func (mock *StoreMock) CreateComponent(c model.Component) (model.Component, error)
- func (mock *StoreMock) CreateComponentCalls() []struct{ ... }
- func (mock *StoreMock) CreateGroup(g model.Group) (model.Group, error)
- func (mock *StoreMock) CreateGroupCalls() []struct{ ... }
- func (mock *StoreMock) CreateUser(u model.User) (model.User, error)
- func (mock *StoreMock) CreateUserCalls() []struct{ ... }
- func (mock *StoreMock) DeleteAPI(ref model.EntityRef) (model.API, error)
- func (mock *StoreMock) DeleteAPICalls() []struct{ ... }
- func (mock *StoreMock) DeleteComponent(ref model.EntityRef) (model.Component, error)
- func (mock *StoreMock) DeleteComponentCalls() []struct{ ... }
- func (mock *StoreMock) DeleteGroup(ref model.EntityRef) (model.Group, error)
- func (mock *StoreMock) DeleteGroupCalls() []struct{ ... }
- func (mock *StoreMock) DeleteUser(ref model.EntityRef) (model.User, error)
- func (mock *StoreMock) DeleteUserCalls() []struct{ ... }
- func (mock *StoreMock) ListComponents(filters []Filter, ordering Ordering, pagination Pagination) ([]model.EntityRef, Pagination, error)
- func (mock *StoreMock) ListComponentsCalls() []struct{ ... }
- func (mock *StoreMock) ReadAPI(ref model.EntityRef) (model.API, error)
- func (mock *StoreMock) ReadAPICalls() []struct{ ... }
- func (mock *StoreMock) ReadComponent(ref model.EntityRef) (model.Component, error)
- func (mock *StoreMock) ReadComponentCalls() []struct{ ... }
- func (mock *StoreMock) ReadGroup(ref model.EntityRef) (model.Group, error)
- func (mock *StoreMock) ReadGroupCalls() []struct{ ... }
- func (mock *StoreMock) ReadUser(ref model.EntityRef) (model.User, error)
- func (mock *StoreMock) ReadUserCalls() []struct{ ... }
- func (mock *StoreMock) UpdateAPI(a model.API) (model.API, error)
- func (mock *StoreMock) UpdateAPICalls() []struct{ ... }
- func (mock *StoreMock) UpdateComponent(c model.Component) (model.Component, error)
- func (mock *StoreMock) UpdateComponentCalls() []struct{ ... }
- func (mock *StoreMock) UpdateGroup(g model.Group) (model.Group, error)
- func (mock *StoreMock) UpdateGroupCalls() []struct{ ... }
- func (mock *StoreMock) UpdateUser(u model.User) (model.User, error)
- func (mock *StoreMock) UpdateUserCalls() []struct{ ... }
Constants ¶
const ( OrderByNamespace = OrderingField("entity.namespace") OrderByName = OrderingField("entity.name") )
Variables ¶
This section is empty.
Functions ¶
func NewSqliteStore ¶
Types ¶
type Ordering ¶
type Ordering struct { OrderBy OrderingField Descending bool }
type OrderingField ¶
type OrderingField string
type Pagination ¶
type Store ¶
type Store interface { CreateComponent(c model.Component) (model.Component, error) ReadComponent(ref model.EntityRef) (model.Component, error) UpdateComponent(c model.Component) (model.Component, error) DeleteComponent(ref model.EntityRef) (model.Component, error) ListComponents(filters []Filter, ordering Ordering, pagination Pagination) ([]model.EntityRef, Pagination, error) CreateAPI(a model.API) (model.API, error) ReadAPI(ref model.EntityRef) (model.API, error) UpdateAPI(a model.API) (model.API, error) DeleteAPI(ref model.EntityRef) (model.API, error) CreateUser(u model.User) (model.User, error) ReadUser(ref model.EntityRef) (model.User, error) UpdateUser(u model.User) (model.User, error) DeleteUser(ref model.EntityRef) (model.User, error) CreateGroup(g model.Group) (model.Group, error) ReadGroup(ref model.EntityRef) (model.Group, error) UpdateGroup(g model.Group) (model.Group, error) DeleteGroup(ref model.EntityRef) (model.Group, error) }
type StoreMock ¶
type StoreMock struct { // CreateAPIFunc mocks the CreateAPI method. CreateAPIFunc func(a model.API) (model.API, error) // CreateComponentFunc mocks the CreateComponent method. CreateComponentFunc func(c model.Component) (model.Component, error) // CreateGroupFunc mocks the CreateGroup method. CreateGroupFunc func(g model.Group) (model.Group, error) // CreateUserFunc mocks the CreateUser method. CreateUserFunc func(u model.User) (model.User, error) // DeleteAPIFunc mocks the DeleteAPI method. DeleteAPIFunc func(ref model.EntityRef) (model.API, error) // DeleteComponentFunc mocks the DeleteComponent method. DeleteComponentFunc func(ref model.EntityRef) (model.Component, error) // DeleteGroupFunc mocks the DeleteGroup method. DeleteGroupFunc func(ref model.EntityRef) (model.Group, error) // DeleteUserFunc mocks the DeleteUser method. DeleteUserFunc func(ref model.EntityRef) (model.User, error) // ListComponentsFunc mocks the ListComponents method. ListComponentsFunc func(filters []Filter, ordering Ordering, pagination Pagination) ([]model.EntityRef, Pagination, error) // ReadAPIFunc mocks the ReadAPI method. ReadAPIFunc func(ref model.EntityRef) (model.API, error) // ReadComponentFunc mocks the ReadComponent method. ReadComponentFunc func(ref model.EntityRef) (model.Component, error) // ReadGroupFunc mocks the ReadGroup method. ReadGroupFunc func(ref model.EntityRef) (model.Group, error) // ReadUserFunc mocks the ReadUser method. ReadUserFunc func(ref model.EntityRef) (model.User, error) // UpdateAPIFunc mocks the UpdateAPI method. UpdateAPIFunc func(a model.API) (model.API, error) // UpdateComponentFunc mocks the UpdateComponent method. UpdateComponentFunc func(c model.Component) (model.Component, error) // UpdateGroupFunc mocks the UpdateGroup method. UpdateGroupFunc func(g model.Group) (model.Group, error) // UpdateUserFunc mocks the UpdateUser method. UpdateUserFunc func(u model.User) (model.User, error) // contains filtered or unexported fields }
StoreMock is a mock implementation of Store.
func TestSomethingThatUsesStore(t *testing.T) { // make and configure a mocked Store mockedStore := &StoreMock{ CreateAPIFunc: func(a model.API) (model.API, error) { panic("mock out the CreateAPI method") }, CreateComponentFunc: func(c model.Component) (model.Component, error) { panic("mock out the CreateComponent method") }, CreateGroupFunc: func(g model.Group) (model.Group, error) { panic("mock out the CreateGroup method") }, CreateUserFunc: func(u model.User) (model.User, error) { panic("mock out the CreateUser method") }, DeleteAPIFunc: func(ref model.EntityRef) (model.API, error) { panic("mock out the DeleteAPI method") }, DeleteComponentFunc: func(ref model.EntityRef) (model.Component, error) { panic("mock out the DeleteComponent method") }, DeleteGroupFunc: func(ref model.EntityRef) (model.Group, error) { panic("mock out the DeleteGroup method") }, DeleteUserFunc: func(ref model.EntityRef) (model.User, error) { panic("mock out the DeleteUser method") }, ListComponentsFunc: func(filters []Filter, ordering Ordering, pagination Pagination) ([]model.EntityRef, Pagination, error) { panic("mock out the ListComponents method") }, ReadAPIFunc: func(ref model.EntityRef) (model.API, error) { panic("mock out the ReadAPI method") }, ReadComponentFunc: func(ref model.EntityRef) (model.Component, error) { panic("mock out the ReadComponent method") }, ReadGroupFunc: func(ref model.EntityRef) (model.Group, error) { panic("mock out the ReadGroup method") }, ReadUserFunc: func(ref model.EntityRef) (model.User, error) { panic("mock out the ReadUser method") }, UpdateAPIFunc: func(a model.API) (model.API, error) { panic("mock out the UpdateAPI method") }, UpdateComponentFunc: func(c model.Component) (model.Component, error) { panic("mock out the UpdateComponent method") }, UpdateGroupFunc: func(g model.Group) (model.Group, error) { panic("mock out the UpdateGroup method") }, UpdateUserFunc: func(u model.User) (model.User, error) { panic("mock out the UpdateUser method") }, } // use mockedStore in code that requires Store // and then make assertions. }
func (*StoreMock) CreateAPICalls ¶
CreateAPICalls gets all the calls that were made to CreateAPI. Check the length with:
len(mockedStore.CreateAPICalls())
func (*StoreMock) CreateComponent ¶
CreateComponent calls CreateComponentFunc.
func (*StoreMock) CreateComponentCalls ¶
CreateComponentCalls gets all the calls that were made to CreateComponent. Check the length with:
len(mockedStore.CreateComponentCalls())
func (*StoreMock) CreateGroup ¶
CreateGroup calls CreateGroupFunc.
func (*StoreMock) CreateGroupCalls ¶
CreateGroupCalls gets all the calls that were made to CreateGroup. Check the length with:
len(mockedStore.CreateGroupCalls())
func (*StoreMock) CreateUser ¶
CreateUser calls CreateUserFunc.
func (*StoreMock) CreateUserCalls ¶
CreateUserCalls gets all the calls that were made to CreateUser. Check the length with:
len(mockedStore.CreateUserCalls())
func (*StoreMock) DeleteAPICalls ¶
DeleteAPICalls gets all the calls that were made to DeleteAPI. Check the length with:
len(mockedStore.DeleteAPICalls())
func (*StoreMock) DeleteComponent ¶
DeleteComponent calls DeleteComponentFunc.
func (*StoreMock) DeleteComponentCalls ¶
DeleteComponentCalls gets all the calls that were made to DeleteComponent. Check the length with:
len(mockedStore.DeleteComponentCalls())
func (*StoreMock) DeleteGroup ¶
DeleteGroup calls DeleteGroupFunc.
func (*StoreMock) DeleteGroupCalls ¶
DeleteGroupCalls gets all the calls that were made to DeleteGroup. Check the length with:
len(mockedStore.DeleteGroupCalls())
func (*StoreMock) DeleteUser ¶
DeleteUser calls DeleteUserFunc.
func (*StoreMock) DeleteUserCalls ¶
DeleteUserCalls gets all the calls that were made to DeleteUser. Check the length with:
len(mockedStore.DeleteUserCalls())
func (*StoreMock) ListComponents ¶
func (mock *StoreMock) ListComponents(filters []Filter, ordering Ordering, pagination Pagination) ([]model.EntityRef, Pagination, error)
ListComponents calls ListComponentsFunc.
func (*StoreMock) ListComponentsCalls ¶
func (mock *StoreMock) ListComponentsCalls() []struct { Filters []Filter Ordering Ordering Pagination Pagination }
ListComponentsCalls gets all the calls that were made to ListComponents. Check the length with:
len(mockedStore.ListComponentsCalls())
func (*StoreMock) ReadAPICalls ¶
ReadAPICalls gets all the calls that were made to ReadAPI. Check the length with:
len(mockedStore.ReadAPICalls())
func (*StoreMock) ReadComponent ¶
ReadComponent calls ReadComponentFunc.
func (*StoreMock) ReadComponentCalls ¶
ReadComponentCalls gets all the calls that were made to ReadComponent. Check the length with:
len(mockedStore.ReadComponentCalls())
func (*StoreMock) ReadGroupCalls ¶
ReadGroupCalls gets all the calls that were made to ReadGroup. Check the length with:
len(mockedStore.ReadGroupCalls())
func (*StoreMock) ReadUserCalls ¶
ReadUserCalls gets all the calls that were made to ReadUser. Check the length with:
len(mockedStore.ReadUserCalls())
func (*StoreMock) UpdateAPICalls ¶
UpdateAPICalls gets all the calls that were made to UpdateAPI. Check the length with:
len(mockedStore.UpdateAPICalls())
func (*StoreMock) UpdateComponent ¶
UpdateComponent calls UpdateComponentFunc.
func (*StoreMock) UpdateComponentCalls ¶
UpdateComponentCalls gets all the calls that were made to UpdateComponent. Check the length with:
len(mockedStore.UpdateComponentCalls())
func (*StoreMock) UpdateGroup ¶
UpdateGroup calls UpdateGroupFunc.
func (*StoreMock) UpdateGroupCalls ¶
UpdateGroupCalls gets all the calls that were made to UpdateGroup. Check the length with:
len(mockedStore.UpdateGroupCalls())
func (*StoreMock) UpdateUser ¶
UpdateUser calls UpdateUserFunc.
func (*StoreMock) UpdateUserCalls ¶
UpdateUserCalls gets all the calls that were made to UpdateUser. Check the length with:
len(mockedStore.UpdateUserCalls())