Help us shape the future of Go! Take the 2026 Go Developer Survey

printer

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 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 *ObjectPrinter) 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"`
}

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.

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"`
}

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"`
}

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.

type ObjectPrinter added in v0.11.0

type ObjectPrinter struct {
	Source  interface{}
	Printer interface{}
}

ObjectPrinter is responsible for encapsulating the source object and also a special printer for outputting it in a tabular format.

func NewBackupPrinter added in v0.7.0

func NewBackupPrinter(backup *ps.Backup) *ObjectPrinter

func NewBackupSlicePrinter added in v0.7.0

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

func NewDatabaseBranchPrinter

func NewDatabaseBranchPrinter(db *ps.DatabaseBranch) *ObjectPrinter

func NewDatabaseBranchSlicePrinter

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

func NewDatabaseBranchStatusPrinter

func NewDatabaseBranchStatusPrinter(status *ps.DatabaseBranchStatus) *ObjectPrinter

func NewDatabasePrinter

func NewDatabasePrinter(db *ps.Database) *ObjectPrinter

func NewDatabaseSlicePrinter

func NewDatabaseSlicePrinter(dbs []*ps.Database) *ObjectPrinter

func NewDeployRequestPrinter

func NewDeployRequestPrinter(dr *planetscale.DeployRequest) *ObjectPrinter

func NewDeployRequestSlicePrinter

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

func NewSchemaSnapshotPrinter

func NewSchemaSnapshotPrinter(ss *planetscale.SchemaSnapshot) *ObjectPrinter

func NewSchemaSnapshotSlicePrinter

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

func NewServiceTokenAccessPrinter added in v0.4.0

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

func NewServiceTokenPrinter added in v0.4.0

func NewServiceTokenPrinter(st *planetscale.ServiceToken) *ObjectPrinter

func NewServiceTokenSlicePrinter added in v0.4.0

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

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.

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.

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.

Jump to

Keyboard shortcuts

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