flypg

package
v0.0.316 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

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) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]PostgresUser, error)

func (*Client) NewRequest

func (c *Client) NewRequest(path string, method string, in interface{}) (*http.Request, 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 Error

type Error struct {
	StatusCode int
	Err        string `json:"error"`
}

func (*Error) Error

func (e *Error) Error() string

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 PostgresDatabase

type PostgresDatabase struct {
	Name  string
	Users []string
}

type PostgresUser

type PostgresUser struct {
	Username  string
	Superuser bool
	Databases []string
}

type RevokeAccessRequest

type RevokeAccessRequest struct {
	Database string `json:"database"`
	Username string `json:"username"`
}

type UserListResponse

type UserListResponse struct {
	Result []PostgresUser
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL