Documentation ¶
Index ¶
- func New() (interface{}, error)
- type Mock
- func (m Mock) Close() error
- func (m Mock) Connection(ctx context.Context) (*MockClient, error)
- func (m *Mock) DeleteUser(ctx context.Context, req dbplugin.DeleteUserRequest) (dbplugin.DeleteUserResponse, error)
- func (m *Mock) Initialize(ctx context.Context, req dbplugin.InitializeRequest) (dbplugin.InitializeResponse, error)
- func (m *Mock) NewUser(ctx context.Context, req dbplugin.NewUserRequest) (dbplugin.NewUserResponse, error)
- func (n *Mock) Type() (string, error)
- func (m *Mock) UpdateUser(ctx context.Context, req dbplugin.UpdateUserRequest) (dbplugin.UpdateUserResponse, error)
- type MockClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
backend wraps the backend framework and adds a map for storing key value pairs
func (Mock) Connection ¶
func (m Mock) Connection(ctx context.Context) (*MockClient, error)
Connection creates a database connection
func (*Mock) DeleteUser ¶
func (m *Mock) DeleteUser(ctx context.Context, req dbplugin.DeleteUserRequest) (dbplugin.DeleteUserResponse, error)
DeleteUser from the database. This should not error if the user didn't exist prior to this call.
func (*Mock) Initialize ¶
func (m *Mock) Initialize(ctx context.Context, req dbplugin.InitializeRequest) (dbplugin.InitializeResponse, error)
Initialize the database plugin. This is the equivalent of a constructor for the database object itself.
func (*Mock) NewUser ¶
func (m *Mock) NewUser(ctx context.Context, req dbplugin.NewUserRequest) (dbplugin.NewUserResponse, error)
NewUser creates a new user within the database. This user is temporary in that it will exist until the TTL expires.
func (*Mock) Type ¶
Type returns the Name for the particular database backend implementation. This type name is usually set as a constant within the database backend implementation, e.g. "mysql" for the MySQL database backend. This is used for things like metrics and logging. No behavior is switched on this.
func (*Mock) UpdateUser ¶
func (m *Mock) UpdateUser(ctx context.Context, req dbplugin.UpdateUserRequest) (dbplugin.UpdateUserResponse, error)
UpdateUser updates an existing user within the database.
type MockClient ¶
type MockClient struct { Username string Password string URL string // contains filtered or unexported fields }
A mock database client used as an example, in a real world this would be an external library provided by a database provider.
func NewMockClient ¶
func NewMockClient(url, username, password string) (MockClient, error)
func (*MockClient) CreateUser ¶
func (c *MockClient) CreateUser(username, password string) mockUser
func (*MockClient) DeleteUser ¶
func (c *MockClient) DeleteUser(username string) error
func (*MockClient) UpdateUser ¶
func (c *MockClient) UpdateUser(username, password string) error