Documentation
¶
Index ¶
- func Duration(d time.Duration, dicimal int) time.Duration
- func ErrorStatus(err error) int
- type Client
- func (c *Client) CreateDatabase(ctx context.Context, name string) error
- func (c *Client) CreateUser(ctx context.Context, name, password string, superuser bool) error
- func (c *Client) DatabaseExists(ctx context.Context, name string) (bool, error)
- func (c *Client) DeleteDatabase(ctx context.Context, name string) error
- func (c Client) DeleteUser(ctx context.Context, name string) error
- func (c *Client) Do(ctx context.Context, method, path string, in, out interface{}) error
- func (c *Client) Failover(ctx context.Context) error
- func (c *Client) ListDatabases(ctx context.Context) ([]PostgresDatabase, error)
- func (c *Client) ListUsers(ctx context.Context) ([]PostgresUser, error)
- func (c *Client) NewRequest(path string, method string, in interface{}) (*http.Request, error)
- func (c *Client) NodeRole(ctx context.Context) (string, error)
- func (c *Client) RestartNode(ctx context.Context) error
- func (c *Client) SettingsView(ctx context.Context, settings []string) (*PGSettings, error)
- func (c *Client) UserExists(ctx context.Context, name string) (bool, error)
- type CommandResponse
- type CreateDatabaseRequest
- type CreateUserRequest
- type DatabaseListResponse
- type DeleteDatabaseRequest
- type DeleteUserRequest
- type Error
- type FindDatabaseResponse
- type FindUserResponse
- type GrantAccessRequest
- type Logger
- type LoggingTransport
- type NodeRoleResponse
- type PGSetting
- type PGSettings
- type PostgresDatabase
- type PostgresUser
- type RestartResponse
- type RevokeAccessRequest
- type SettingsViewResponse
- type UserListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorStatus ¶
func ErrorStatus(err error) int
Types ¶
type Client ¶
type Client struct {
BaseURL string
// contains filtered or unexported fields
}
func New ¶
func New(app string, dialer agent.Dialer) *Client
New creates an http client to the fly postgres http server running on port 5500 over userland wireguard provided by the agent
func NewFromInstance ¶ added in v0.0.319
func NewFromInstance(address string, dialer agent.Dialer) *Client
NewFromInstance creates a new Client that targets a specific instance(address)
func (*Client) CreateDatabase ¶
func (c *Client) CreateDatabase(ctx context.Context, name string) error
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, name, password string, superuser bool) error
func (*Client) DatabaseExists ¶
func (c *Client) DatabaseExists(ctx context.Context, name string) (bool, error)
func (*Client) DeleteDatabase ¶
func (c *Client) DeleteDatabase(ctx context.Context, name string) error
func (Client) DeleteUser ¶
func (c Client) DeleteUser(ctx context.Context, name string) error
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, method, path string, in, out interface{}) error
func (*Client) ListDatabases ¶
func (c *Client) ListDatabases(ctx context.Context) ([]PostgresDatabase, error)
func (*Client) NewRequest ¶
func (c *Client) NewRequest(path string, method string, in interface{}) (*http.Request, error)
func (*Client) NodeRole ¶ added in v0.0.319
func (c *Client) NodeRole(ctx context.Context) (string, error)
func (*Client) RestartNode ¶ added in v0.0.319
func (c *Client) RestartNode(ctx context.Context) error
func (*Client) SettingsView ¶ added in v0.0.319
func (c *Client) SettingsView(ctx context.Context, settings []string) (*PGSettings, error)
func (*Client) UserExists ¶
func (c *Client) UserExists(ctx context.Context, name string) (bool, error)
type CommandResponse ¶
type CommandResponse struct {
Result bool `json:"result"`
Error string `json:"error"`
}
type CreateDatabaseRequest ¶
type CreateDatabaseRequest struct {
Name string `json:"name"`
}
type CreateUserRequest ¶
type CreateUserRequest struct {
Username string `json:"username"`
Password string `json:"password"`
Superuser bool `json:"superuser"`
}
type DatabaseListResponse ¶
type DatabaseListResponse struct {
Result []PostgresDatabase
}
type DeleteDatabaseRequest ¶
type DeleteDatabaseRequest struct {
Name string `json:"name"`
}
type DeleteUserRequest ¶
type DeleteUserRequest struct {
Username string `json:"username"`
}
type FindDatabaseResponse ¶
type FindDatabaseResponse struct {
Result PostgresDatabase
}
type FindUserResponse ¶
type FindUserResponse struct {
Result PostgresUser
}
type GrantAccessRequest ¶
type GrantAccessRequest struct {
Database string `json:"database"`
Username string `json:"username"`
}
type Logger ¶ added in v0.0.326
type Logger interface {
Debug(v ...interface{})
Debugf(format string, v ...interface{})
}
type LoggingTransport ¶ added in v0.0.326
type LoggingTransport struct {
// contains filtered or unexported fields
}
type NodeRoleResponse ¶ added in v0.0.319
type NodeRoleResponse struct {
Result string
}
type PGSetting ¶ added in v0.0.319
type PGSetting struct {
Name string `json:"name,omitempty"`
Setting string `json:"setting,omitempty"`
VarType string `json:"vartype,omitempty"`
MinVal string `json:"min_val,omitempty"`
MaxVal string `json:"max_val,omitempty"`
EnumVals []string `json:"enumvals,omitempty"`
Context string `json:"context,omitempty"`
Unit string `json:"unit,omitempty"`
Desc string `json:"short_desc,omitempty"`
PendingChange string `json:"pending_change,omitempty"`
PendingRestart bool `json:"pending_restart,omitempty"`
}
type PGSettings ¶ added in v0.0.319
type PGSettings struct {
Settings []PGSetting `json:"settings,omitempty"`
}
type PostgresDatabase ¶
type PostgresDatabase struct {
Name string
Users []string
}
type PostgresUser ¶
type PostgresUser struct {
Username string
Superuser bool
Databases []string
}
type RestartResponse ¶ added in v0.0.319
type RestartResponse struct {
Result string
}
type RevokeAccessRequest ¶
type RevokeAccessRequest struct {
Database string `json:"database"`
Username string `json:"username"`
}
type SettingsViewResponse ¶ added in v0.0.319
type SettingsViewResponse struct {
Result PGSettings
}
type UserListResponse ¶
type UserListResponse struct {
Result []PostgresUser
}
Click to show internal directories.
Click to hide internal directories.