printer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 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 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"`

	Branch     string `header:"branch,timestamp(ms|utc|human)" json:"branch"`
	IntoBranch string `header:"into_branch,timestamp(ms|utc|human)" json:"into_branch"`

	Notes string `header:"notes" json:"notes"`

	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

Jump to

Keyboard shortcuts

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