printer

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJSON

func PrintJSON(obj interface{}) error

PrintJSON pretty prints the object as JSON.

func PrintOutput

func PrintOutput(isJSON bool, obj interface{}) error

PrintOutput prints the output as JSON or in a table format.

Types

type Backup added in v0.7.0

type Backup struct {
	Name        string `header:"name" json:"name"`
	State       string `header:"state" json:"state"`
	Size        int64  `header:"size" json:"size"`
	CreatedAt   int64  `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
	UpdatedAt   int64  `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`
	StartedAt   int64  `header:"started_at,timestamp(ms|utc|human)" json:"started_at"`
	ExpiresAt   int64  `header:"expires_at,timestamp(ms|utc|human)" json:"expires_at"`
	CompletedAt int64  `header:"completed_at,timestamp(ms|utc|human)" json:"completed_at"`
}

func NewBackupPrinter added in v0.7.0

func NewBackupPrinter(backup *ps.Backup) *Backup

Returns a struct that prints out the various fields of a branch model.

func NewBackupSlicePrinter added in v0.7.0

func NewBackupSlicePrinter(backups []*ps.Backup) []*Backup

type Database

type Database struct {
	Name      string `header:"name" json:"name"`
	CreatedAt int64  `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
	UpdatedAt int64  `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`
	Notes     string `header:"notes" json:"notes"`
}

Database returns a table-serializable database model.

func NewDatabasePrinter

func NewDatabasePrinter(db *ps.Database) *Database

NewDatabasePrinter returns a struct that prints out the various fields of a database model.

func NewDatabaseSlicePrinter

func NewDatabaseSlicePrinter(databases []*ps.Database) []*Database

NewDatabaseSlicePrinter returns a slice of printable databases.

type DatabaseBranch

type DatabaseBranch struct {
	Name         string `header:"name" json:"name"`
	Status       string `header:"status" json:"status"`
	ParentBranch string `header:"parent branch,n/a" json:"parent_branch"`
	CreatedAt    int64  `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
	UpdatedAt    int64  `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`
	Notes        string `header:"notes" json:"notes"`
}

func NewDatabaseBranchPrinter

func NewDatabaseBranchPrinter(db *ps.DatabaseBranch) *DatabaseBranch

NewDatabaseBranchPrinter returns a struct that prints out the various fields of a database model.

func NewDatabaseBranchSlicePrinter

func NewDatabaseBranchSlicePrinter(branches []*ps.DatabaseBranch) []*DatabaseBranch

type DatabaseBranchStatus

type DatabaseBranchStatus struct {
	Status      string `header:"status" json:"status"`
	GatewayHost string `header:"gateway_host" json:"gateway_host"`
	GatewayPort int    `header:"gateway_port,text" json:"gateway_port"`
	User        string `header:"username" json:"user"`
	Password    string `header:"password" json:"password"`
}

func NewDatabaseBranchStatusPrinter

func NewDatabaseBranchStatusPrinter(status *ps.DatabaseBranchStatus) *DatabaseBranchStatus

type DeployRequest

type DeployRequest struct {
	ID         string `header:"id" json:"id"`
	Number     uint64 `header:"number" json:"number"`
	Branch     string `header:"branch,timestamp(ms|utc|human)" json:"branch"`
	IntoBranch string `header:"into_branch,timestamp(ms|utc|human)" json:"into_branch"`

	Approved bool `header:"approved" json:"approved"`
	Ready    bool `header:"ready" json:"ready"`

	DeploymentState     string `header:"deployment_state,n/a" json:"deployment_state"`
	State               string `header:"state" json:"state"`
	DeployabilityErrors string `header:"errors" json:"deployability_errors"`

	CreatedAt int64  `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
	UpdatedAt int64  `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`
	ClosedAt  *int64 `header:"closed_at,timestamp(ms|utc|human),-" json:"closed_at"`
}

DeployRequest returns a table-serializable deplo request model.

func NewDeployRequestPrinter

func NewDeployRequestPrinter(dr *planetscale.DeployRequest) *DeployRequest

func NewDeployRequestSlicePrinter

func NewDeployRequestSlicePrinter(deployRequests []*planetscale.DeployRequest) []*DeployRequest

type SchemaSnapshot

type SchemaSnapshot struct {
	ID        string `header:"id" json:"id"`
	Name      string `header:"name" json:"name"`
	CreatedAt int64  `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
	UpdatedAt int64  `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`
}

SchemaSnapshot returns a table and json serializable schema snapshot.

func NewSchemaSnapshotPrinter

func NewSchemaSnapshotPrinter(ss *planetscale.SchemaSnapshot) *SchemaSnapshot

NewSchemaSnapshotPrinter returns a struct that prints out the various fields of a schema snapshot model.

func NewSchemaSnapshotSlicePrinter

func NewSchemaSnapshotSlicePrinter(schemaSnapshots []*ps.SchemaSnapshot) []*SchemaSnapshot

type ServiceToken added in v0.4.0

type ServiceToken struct {
	Name  string `header:"name" json:"name"`
	Token string `header:"token" json:"token"`
}

ServiceToken returns a table and json serializable schema snapshot.

func NewServiceTokenPrinter added in v0.4.0

func NewServiceTokenPrinter(st *planetscale.ServiceToken) *ServiceToken

NewServiceTokenPrinter returns a struct that prints out the various fields of a schema snapshot model.

func NewServiceTokenSlicePrinter added in v0.4.0

func NewServiceTokenSlicePrinter(serviceTokens []*ps.ServiceToken) []*ServiceToken

type ServiceTokenAccess added in v0.4.0

type ServiceTokenAccess struct {
	Database string   `header:"database" json:"database"`
	Accesses []string `header:"accesses" json:"accesses"`
}

ServiceTokenAccess returns a table and json serializable schema snapshot.

func NewServiceTokenAccessPrinter added in v0.4.0

func NewServiceTokenAccessPrinter(st []*planetscale.ServiceTokenAccess) []*ServiceTokenAccess

NewServiceTokenPrinter returns a struct that prints out the various fields of a schema snapshot model.

Jump to

Keyboard shortcuts

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