Documentation
¶
Index ¶
- Variables
- func GetFeatureError(body []byte, feature string) error
- func Header(key, value string) map[string]string
- func LocationsTable(columns []interface{}) table.Table
- func ProbeLocation(location string) *time.Duration
- type ApiToken
- type ApiTokensClient
- type AuditLog
- type AuditLogData
- type AuditLogsPagination
- type AuditLogsResponse
- type BillingAddress
- type BillingClient
- func (c *BillingClient) CreateStripeCustomer(name string) (string, error)
- func (c *BillingClient) GetBillingCustomer() (BillingCustomer, error)
- func (c *BillingClient) HasPaymentMethod() (bool, error)
- func (c *BillingClient) HasPaymentMethodWithStripeId(stripeId string) (bool, error)
- func (c *BillingClient) Portal() (Portal, error)
- func (c *BillingClient) PortalForStripeId(stripeId string) (Portal, error)
- func (c *BillingClient) UpdateBillingCustomer(customer BillingCustomer) error
- type BillingCustomer
- type Body
- type Client
- func (t *Client) Delete(path string, body io.Reader) (*http.Response, error)
- func (t *Client) Get(path string, body io.Reader) (*http.Response, error)
- func (t *Client) GetWithHeaders(path string, body io.Reader, headers map[string]string) (*http.Response, error)
- func (t *Client) Patch(path string, body io.Reader) (*http.Response, error)
- func (t *Client) Post(path string, body io.Reader) (*http.Response, error)
- func (t *Client) PostBinary(path string, body io.Reader) (*http.Response, error)
- func (t *Client) Put(path string, body io.Reader) (*http.Response, error)
- func (t *Client) Upload(path string, fileData *os.File) (*http.Response, error)
- type ClosestLocationResponse
- type CreateApiToken
- type CreateDatabaseBody
- type CreateDatabaseResponse
- type CreateInstanceLocationError
- type DBSeed
- type Database
- type DatabaseConfig
- type DatabaseListOptions
- type DatabaseTokenRequest
- type DatabasesClient
- func (d *DatabasesClient) Create(name, location, image, extensions, group string, schema string, isSchema bool, ...) (*CreateDatabaseResponse, error)
- func (d *DatabasesClient) Delete(database string) error
- func (d *DatabasesClient) GetConfig(database string) (DatabaseConfig, error)
- func (d *DatabasesClient) List(options DatabaseListOptions) (ListResponse, error)
- func (d *DatabasesClient) Rotate(database string) error
- func (d *DatabasesClient) Seed(name string, dbFile *os.File) error
- func (d *DatabasesClient) Stats(database string) ([]Stats, error)
- func (d *DatabasesClient) Token(database string, expiration string, readOnly bool, ...) (string, error)
- func (d *DatabasesClient) Transfer(database, org string) error
- func (d *DatabasesClient) URL(suffix string) string
- func (d *DatabasesClient) Update(database string, group bool) error
- func (d *DatabasesClient) UpdateConfig(database string, config DatabaseConfig) error
- func (d *DatabasesClient) UploadDatabaseAWS(resp *CreateDatabaseResponse, group string, uploadFilepath string, ...) (*CreateDatabaseResponse, error)
- func (d *DatabasesClient) UploadDump(dbFile *os.File) (string, error)
- func (d *DatabasesClient) Usage(database string) (DbUsage, error)
- func (d *DatabasesClient) Wakeup(database string) error
- type DbUsage
- type DbUsageResponse
- type Entities
- type ErrorResponseDetails
- type Group
- type GroupConfig
- type GroupStatus
- type GroupTokenRequest
- type GroupsClient
- func (d *GroupsClient) AddLocation(name, location string) error
- func (d *GroupsClient) Create(name, location, version string) error
- func (d *GroupsClient) Delete(group string) error
- func (d *GroupsClient) Get(name string) (Group, error)
- func (g *GroupsClient) GetConfig(group string) (GroupConfig, error)
- func (d *GroupsClient) List() ([]Group, error)
- func (d *GroupsClient) RemoveLocation(name, location string) error
- func (d *GroupsClient) Rotate(group string) error
- func (d *GroupsClient) Token(group string, expiration string, readOnly bool, permissions *PermissionsClaim) (string, error)
- func (d *GroupsClient) Transfer(group string, to string) error
- func (d *GroupsClient) URL(suffix string) string
- func (d *GroupsClient) Unarchive(name string) error
- func (d *GroupsClient) Update(group string, version, extensions string) error
- func (g *GroupsClient) UpdateConfig(group string, config GroupConfig) error
- func (d *GroupsClient) WaitLocation(name, location string) error
- type Instance
- type InstanceUsage
- type InstancesClient
- func (d *InstancesClient) Create(dbName, location string) (*Instance, error)
- func (i *InstancesClient) Delete(db, instance string) error
- func (i *InstancesClient) List(db string) ([]Instance, error)
- func (d *InstancesClient) URL(database, suffix string) string
- func (i *InstancesClient) Wait(db, instance string) error
- type Invite
- type Invoice
- type InvoicesClient
- type ListResponse
- type Location
- type LocationResponse
- type LocationStatus
- type LocationsClient
- type LocationsResponse
- type Member
- type OrgLocations
- type OrgLocationsResponse
- type OrgTotal
- type OrgUsage
- type OrgUsageResponse
- type Organization
- type OrganizationsClient
- func (c *OrganizationsClient) AddMember(username, role string) error
- func (c *OrganizationsClient) AuditLogs(org string, page int, limit int) (AuditLogsResponse, error)
- func (c *OrganizationsClient) Create(name string, stripeId string, dryRun bool) (Organization, error)
- func (c *OrganizationsClient) Delete(slug string) error
- func (c *OrganizationsClient) DeleteInvite(email string) error
- func (c *OrganizationsClient) InviteMember(email, role string) error
- func (c *OrganizationsClient) List() ([]Organization, error)
- func (c *OrganizationsClient) ListInvites() ([]Invite, error)
- func (c *OrganizationsClient) ListMembers() ([]Member, error)
- func (c *OrganizationsClient) Locations() (OrgLocations, error)
- func (c *OrganizationsClient) MembersURL(suffix string) (string, error)
- func (c *OrganizationsClient) RemoveMember(username string) error
- func (c *OrganizationsClient) SetOverages(slug string, toggle bool) error
- func (c *OrganizationsClient) Usage() (OrgUsage, error)
- type Pagination
- type PermissionsClaim
- type Plan
- type PlansClient
- type Portal
- type Stats
- type Subscription
- type SubscriptionClient
- type TaxID
- type TokensClient
- type TursoServerClient
- type Usage
- type UserInfo
- type UserInfoResponse
- type UsersClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPaymentRequired = errors.New("payment required")
Functions ¶
func GetFeatureError ¶ added in v1.0.7
func LocationsTable ¶
func ProbeLocation ¶
Types ¶
type ApiTokensClient ¶
type ApiTokensClient client
func (*ApiTokensClient) Create ¶
func (a *ApiTokensClient) Create(name string) (CreateApiToken, error)
func (*ApiTokensClient) List ¶
func (a *ApiTokensClient) List() ([]ApiToken, error)
func (*ApiTokensClient) Revoke ¶
func (a *ApiTokensClient) Revoke(name string) error
type AuditLog ¶ added in v1.0.7
type AuditLog struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Data AuditLogData `json:"data,omitempty"`
Origin string `json:"origin,omitempty"`
Author string `json:"author,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
City string `json:"city,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Latitude string `json:"latitude,omitempty"`
Longitude string `json:"longitude,omitempty"`
IP string `json:"ip,omitempty"`
}
type AuditLogData ¶ added in v1.0.7
type AuditLogData map[string]interface{}
type AuditLogsPagination ¶ added in v1.0.7
type AuditLogsResponse ¶ added in v1.0.7
type AuditLogsResponse struct {
AuditLogs []AuditLog `json:"audit_logs"`
Pagination AuditLogsPagination `json:"pagination"`
}
type BillingAddress ¶ added in v0.92.0
type BillingClient ¶
type BillingClient client
func (*BillingClient) CreateStripeCustomer ¶
func (c *BillingClient) CreateStripeCustomer(name string) (string, error)
func (*BillingClient) GetBillingCustomer ¶ added in v0.92.0
func (c *BillingClient) GetBillingCustomer() (BillingCustomer, error)
func (*BillingClient) HasPaymentMethod ¶
func (c *BillingClient) HasPaymentMethod() (bool, error)
func (*BillingClient) HasPaymentMethodWithStripeId ¶
func (c *BillingClient) HasPaymentMethodWithStripeId(stripeId string) (bool, error)
func (*BillingClient) Portal ¶
func (c *BillingClient) Portal() (Portal, error)
func (*BillingClient) PortalForStripeId ¶
func (c *BillingClient) PortalForStripeId(stripeId string) (Portal, error)
func (*BillingClient) UpdateBillingCustomer ¶ added in v0.92.0
func (c *BillingClient) UpdateBillingCustomer(customer BillingCustomer) error
type BillingCustomer ¶ added in v0.92.0
type BillingCustomer struct {
Name string `json:"name"`
Email string `json:"email"`
TaxID TaxID `json:"tax_id"`
BillingAddress BillingAddress `json:"billing_address"`
}
type Client ¶
type Client struct {
Org string
Instances *InstancesClient
Databases *DatabasesClient
Organizations *OrganizationsClient
ApiTokens *ApiTokensClient
Locations *LocationsClient
Tokens *TokensClient
Users *UsersClient
Plans *PlansClient
Subscriptions *SubscriptionClient
Billing *BillingClient
Groups *GroupsClient
Invoices *InvoicesClient
// contains filtered or unexported fields
}
Collection of all turso clients
func (*Client) GetWithHeaders ¶ added in v1.0.6
func (*Client) PostBinary ¶ added in v0.99.0
type ClosestLocationResponse ¶
type ClosestLocationResponse struct {
Server string
}
type CreateApiToken ¶
type CreateDatabaseBody ¶
type CreateDatabaseBody struct {
Name string `json:"name"`
Location string `json:"location"`
Image string `json:"image,omitempty"`
Extensions string `json:"extensions,omitempty"`
Group string `json:"group,omitempty"`
Seed *DBSeed `json:"seed,omitempty"`
Schema string `json:"schema,omitempty"`
IsSchema bool `json:"is_schema,omitempty"`
SizeLimit string `json:"size_limit,omitempty"`
}
type CreateDatabaseResponse ¶
type CreateInstanceLocationError ¶
type CreateInstanceLocationError struct {
// contains filtered or unexported fields
}
func (*CreateInstanceLocationError) Error ¶
func (e *CreateInstanceLocationError) Error() string
type DBSeed ¶
type DBSeed struct {
Type string `json:"type"`
Name string `json:"value,omitempty"`
URL string `json:"url,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
// This is only used locally when uploading a database file and
// never passed to the control plane as JSON.
Filepath string `json:"-"`
}
type DatabaseConfig ¶ added in v0.88.9
type DatabaseConfig struct {
AllowAttach *bool `json:"allow_attach"`
DeleteProtection *bool `json:"delete_protection"`
}
func (*DatabaseConfig) AttachAllowed ¶ added in v1.0.4
func (d *DatabaseConfig) AttachAllowed() bool
func (*DatabaseConfig) IsDeleteProtected ¶ added in v1.0.4
func (d *DatabaseConfig) IsDeleteProtected() bool
type DatabaseListOptions ¶ added in v0.96.4
type DatabaseListOptions struct {
Group string
Schema string
Limit int
Cursor string
Parent string
}
func (DatabaseListOptions) Encode ¶ added in v0.96.4
func (o DatabaseListOptions) Encode() string
type DatabaseTokenRequest ¶ added in v0.88.7
type DatabaseTokenRequest struct {
Permissions *PermissionsClaim `json:"permissions,omitempty"`
}
type DatabasesClient ¶
type DatabasesClient client
func (*DatabasesClient) Create ¶
func (d *DatabasesClient) Create(name, location, image, extensions, group string, schema string, isSchema bool, seed *DBSeed, sizeLimit string, spinner *prompt.SpinnerT) (*CreateDatabaseResponse, error)
func (*DatabasesClient) Delete ¶
func (d *DatabasesClient) Delete(database string) error
func (*DatabasesClient) GetConfig ¶ added in v0.88.9
func (d *DatabasesClient) GetConfig(database string) (DatabaseConfig, error)
func (*DatabasesClient) List ¶
func (d *DatabasesClient) List(options DatabaseListOptions) (ListResponse, error)
func (*DatabasesClient) Rotate ¶
func (d *DatabasesClient) Rotate(database string) error
func (*DatabasesClient) Stats ¶ added in v0.88.3
func (d *DatabasesClient) Stats(database string) ([]Stats, error)
func (*DatabasesClient) Token ¶
func (d *DatabasesClient) Token(database string, expiration string, readOnly bool, permissions *PermissionsClaim) (string, error)
func (*DatabasesClient) Transfer ¶
func (d *DatabasesClient) Transfer(database, org string) error
func (*DatabasesClient) URL ¶
func (d *DatabasesClient) URL(suffix string) string
func (*DatabasesClient) Update ¶
func (d *DatabasesClient) Update(database string, group bool) error
func (*DatabasesClient) UpdateConfig ¶ added in v0.88.9
func (d *DatabasesClient) UpdateConfig(database string, config DatabaseConfig) error
func (*DatabasesClient) UploadDatabaseAWS ¶ added in v0.99.0
func (d *DatabasesClient) UploadDatabaseAWS(resp *CreateDatabaseResponse, group string, uploadFilepath string, spinner *prompt.SpinnerT) (*CreateDatabaseResponse, error)
UploadDatabaseAWS creates a database from an uploaded database file
- It creates a database on the control plane as normal, but passes a special seed type which instructs the control plane create the db as 'draft', i.e. in a mode where it is not yet available for use. This call happens in DatabasesClient.Create() above, after which it calls this function.
- This function creates a DB token for the newly-created DB, and then calls turso-server to upload the database file. turso-server will perform validations on the file and 'activate' the db if everything is ok.
func (*DatabasesClient) UploadDump ¶
func (d *DatabasesClient) UploadDump(dbFile *os.File) (string, error)
func (*DatabasesClient) Wakeup ¶ added in v0.88.4
func (d *DatabasesClient) Wakeup(database string) error
type DbUsage ¶
type DbUsage struct {
UUID string `json:"uuid,omitempty"`
Instances []InstanceUsage `json:"instances"`
Usage Usage `json:"usage"`
}
type DbUsageResponse ¶
type DbUsageResponse struct {
DbUsage DbUsage `json:"database"`
}
type Entities ¶ added in v0.88.7
type Entities struct {
DBNames []string `json:"databases,omitempty"`
}
type ErrorResponseDetails ¶ added in v1.0.7
type ErrorResponseDetails struct {
Error interface{} `json:"error"`
Code string `json:"code"`
}
type GroupConfig ¶ added in v1.0.4
type GroupConfig struct {
DeleteProtection *bool `json:"delete_protection"`
}
func (*GroupConfig) IsDeleteProtected ¶ added in v1.0.4
func (g *GroupConfig) IsDeleteProtected() bool
type GroupStatus ¶ added in v0.95.0
type GroupStatus struct {
Locations []LocationStatus `json:"locations"`
}
type GroupTokenRequest ¶ added in v0.88.7
type GroupTokenRequest struct {
Permissions *PermissionsClaim `json:"permissions,omitempty"`
}
type GroupsClient ¶
type GroupsClient client
func (*GroupsClient) AddLocation ¶
func (d *GroupsClient) AddLocation(name, location string) error
func (*GroupsClient) Create ¶
func (d *GroupsClient) Create(name, location, version string) error
func (*GroupsClient) Delete ¶
func (d *GroupsClient) Delete(group string) error
func (*GroupsClient) GetConfig ¶ added in v1.0.4
func (g *GroupsClient) GetConfig(group string) (GroupConfig, error)
func (*GroupsClient) List ¶
func (d *GroupsClient) List() ([]Group, error)
func (*GroupsClient) RemoveLocation ¶
func (d *GroupsClient) RemoveLocation(name, location string) error
func (*GroupsClient) Rotate ¶
func (d *GroupsClient) Rotate(group string) error
func (*GroupsClient) Token ¶
func (d *GroupsClient) Token(group string, expiration string, readOnly bool, permissions *PermissionsClaim) (string, error)
func (*GroupsClient) Transfer ¶ added in v0.88.0
func (d *GroupsClient) Transfer(group string, to string) error
func (*GroupsClient) URL ¶
func (d *GroupsClient) URL(suffix string) string
func (*GroupsClient) Unarchive ¶ added in v0.87.5
func (d *GroupsClient) Unarchive(name string) error
func (*GroupsClient) Update ¶ added in v0.87.8
func (d *GroupsClient) Update(group string, version, extensions string) error
func (*GroupsClient) UpdateConfig ¶ added in v1.0.4
func (g *GroupsClient) UpdateConfig(group string, config GroupConfig) error
func (*GroupsClient) WaitLocation ¶ added in v0.86.2
func (d *GroupsClient) WaitLocation(name, location string) error
type InstanceUsage ¶
type InstancesClient ¶
type InstancesClient client
func (*InstancesClient) Create ¶
func (d *InstancesClient) Create(dbName, location string) (*Instance, error)
func (*InstancesClient) Delete ¶
func (i *InstancesClient) Delete(db, instance string) error
func (*InstancesClient) URL ¶
func (d *InstancesClient) URL(database, suffix string) string
func (*InstancesClient) Wait ¶
func (i *InstancesClient) Wait(db, instance string) error
type Invoice ¶ added in v0.91.0
type Invoice struct {
Number string `json:"invoice_number"`
Amount string `json:"amount_due"`
DueDate string `json:"due_date"`
PaidAt string `json:"paid_at"`
PaymentFailedAt string `json:"payment_failed_at"`
InvoicePdf string `json:"invoice_pdf"`
Status string `json:"status"`
HostedInvoiceUrl string `json:"hosted_invoice_url"`
}
type InvoicesClient ¶ added in v0.91.0
type InvoicesClient client
func (*InvoicesClient) List ¶ added in v0.91.0
func (i *InvoicesClient) List(invoiceType string) ([]Invoice, error)
func (*InvoicesClient) URL ¶ added in v0.91.0
func (i *InvoicesClient) URL(suffix string) string
type ListResponse ¶ added in v1.0.7
type ListResponse struct {
Databases []Database `json:"databases"`
Pagination *Pagination `json:"pagination,omitempty"`
}
type LocationResponse ¶
type LocationStatus ¶ added in v0.95.0
type LocationsClient ¶
type LocationsClient client
func (*LocationsClient) Closest ¶
func (c *LocationsClient) Closest() (string, error)
func (*LocationsClient) Get ¶
func (c *LocationsClient) Get(location string) (LocationResponse, error)
type LocationsResponse ¶
type OrgLocations ¶ added in v1.0.7
type OrgLocationsResponse ¶ added in v1.0.7
type OrgLocationsResponse struct {
Locations OrgLocations
}
type OrgTotal ¶
type OrgTotal struct {
RowsRead uint64 `json:"rows_read,omitempty"`
RowsWritten uint64 `json:"rows_written,omitempty"`
StorageBytesUsed uint64 `json:"storage_bytes,omitempty"`
BytesSynced uint64 `json:"bytes_synced,omitempty"`
Databases uint64 `json:"databases,omitempty"`
Locations uint64 `json:"locations,omitempty"`
Groups uint64 `json:"groups,omitempty"`
}
type OrgUsageResponse ¶
type OrgUsageResponse struct {
OrgUsage OrgUsage `json:"organization"`
}
type Organization ¶
type OrganizationsClient ¶
type OrganizationsClient client
func (*OrganizationsClient) AddMember ¶
func (c *OrganizationsClient) AddMember(username, role string) error
func (*OrganizationsClient) AuditLogs ¶ added in v1.0.7
func (c *OrganizationsClient) AuditLogs(org string, page int, limit int) (AuditLogsResponse, error)
func (*OrganizationsClient) Create ¶
func (c *OrganizationsClient) Create(name string, stripeId string, dryRun bool) (Organization, error)
func (*OrganizationsClient) Delete ¶
func (c *OrganizationsClient) Delete(slug string) error
func (*OrganizationsClient) DeleteInvite ¶ added in v0.93.0
func (c *OrganizationsClient) DeleteInvite(email string) error
func (*OrganizationsClient) InviteMember ¶
func (c *OrganizationsClient) InviteMember(email, role string) error
func (*OrganizationsClient) List ¶
func (c *OrganizationsClient) List() ([]Organization, error)
func (*OrganizationsClient) ListInvites ¶ added in v0.93.0
func (c *OrganizationsClient) ListInvites() ([]Invite, error)
func (*OrganizationsClient) ListMembers ¶
func (c *OrganizationsClient) ListMembers() ([]Member, error)
func (*OrganizationsClient) Locations ¶ added in v1.0.7
func (c *OrganizationsClient) Locations() (OrgLocations, error)
func (*OrganizationsClient) MembersURL ¶
func (c *OrganizationsClient) MembersURL(suffix string) (string, error)
func (*OrganizationsClient) RemoveMember ¶
func (c *OrganizationsClient) RemoveMember(username string) error
func (*OrganizationsClient) SetOverages ¶
func (c *OrganizationsClient) SetOverages(slug string, toggle bool) error
func (*OrganizationsClient) Usage ¶
func (c *OrganizationsClient) Usage() (OrgUsage, error)
type Pagination ¶ added in v1.0.7
type Pagination struct {
Next *string `json:"next"`
}
type PermissionsClaim ¶ added in v0.88.7
type PermissionsClaim struct {
ReadAttach Entities `json:"read_attach,omitempty"`
}
type Plan ¶
type Plan struct {
Name string `json:"name"`
Price string `json:"price"`
Quotas struct {
RowsRead uint64 `json:"rowsRead"`
RowsWritten uint64 `json:"rowsWritten"`
Databases uint64 `json:"databases"`
BytesSynced uint64 `json:"bytesSynced"`
Locations uint64 `json:"locations"`
Storage uint64 `json:"storage"`
Groups uint64 `json:"groups"`
}
}
type PlansClient ¶
type PlansClient client
func (*PlansClient) List ¶
func (c *PlansClient) List() ([]Plan, error)
type Subscription ¶ added in v0.90.4
type SubscriptionClient ¶
type SubscriptionClient client
func (*SubscriptionClient) Get ¶
func (c *SubscriptionClient) Get() (Subscription, error)
type TokensClient ¶
type TokensClient client
func (*TokensClient) Invalidate ¶ added in v0.88.4
func (c *TokensClient) Invalidate() (int64, error)
type TursoServerClient ¶ added in v0.99.0
type TursoServerClient struct {
// contains filtered or unexported fields
}
func NewTursoServerClient ¶ added in v0.99.0
func (*TursoServerClient) UploadFile ¶ added in v0.99.0
func (i *TursoServerClient) UploadFile(filepath string, onUploadProgress func(progressPct int, uploadedBytes int64, totalBytes int64, elapsedTime time.Duration, done bool)) error
UploadFile uploads a database file to the Turso server. it assumes a SQLite file exists at 'filepath'. it streams the file to the server, and calls the onProgress callback with the progress of the upload.
type UserInfoResponse ¶
type UserInfoResponse struct {
User UserInfo `json:"user"`
}
type UsersClient ¶
type UsersClient client
func (*UsersClient) GetUser ¶
func (u *UsersClient) GetUser() (UserInfo, error)
Click to show internal directories.
Click to hide internal directories.