database

package
v0.10.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Overview

Example (RespDBlist_json)
display.Print(
	&respDBList{Info: []*types.DatasetIdentifier{
		{
			Name:      "db_a",
			Owner:     testOwner,
			Namespace: "one",
		},
		{
			Name:      "db_b",
			Owner:     testOwner,
			Namespace: "two",
		},
	}},
	nil, "json")
Output:

{
  "result": [
    {
      "name": "db_a",
      "owner": "6f776e6572",
      "namespace": "one"
    },
    {
      "name": "db_b",
      "owner": "6f776e6572",
      "namespace": "two"
    }
  ],
  "error": ""
}
Example (RespDBlist_text)
display.Print(
	&respDBList{Info: []*types.DatasetIdentifier{
		{
			Name:      "db_a",
			Owner:     testOwner,
			Namespace: "one",
		},
		{
			Name:      "db_b",
			Owner:     testOwner,
			Namespace: "two",
		},
	},
		owner: testOwner},
	nil, "text")
Output:

Databases belonging to '6f776e6572':
  Namespace: one
    Name: db_a
    Owner: 6f776e6572
  Namespace: two
    Name: db_b
    Owner: 6f776e6572
Example (RespDBlist_text_0)
display.Print(
	&respDBList{Info: []*types.DatasetIdentifier{}, owner: testOwner},
	nil, "text")
Output:

No databases found for '6f776e6572'.
Example (RespRelations_json)
display.Print(&respRelations{
	Data: &types.QueryResult{
		ColumnNames: []string{"a", "b"},
		ColumnTypes: []*types.DataType{types.TextType, types.TextType},
		Values:      [][]any{{"1", "2"}, {"3", "4"}},
	},
},
	nil, "json")
Output:

{
  "result": {
    "column_names": [
      "a",
      "b"
    ],
    "column_types": [
      {
        "name": "text",
        "is_array": false,
        "metadata": [
          0,
          0
        ]
      },
      {
        "name": "text",
        "is_array": false,
        "metadata": [
          0,
          0
        ]
      }
    ],
    "values": [
      [
        "1",
        "2"
      ],
      [
        "3",
        "4"
      ]
    ]
  },
  "error": ""
}
Example (RespRelations_text)
display.Print(&respRelations{
	Data: &types.QueryResult{
		ColumnNames: []string{"a", "b"},
		ColumnTypes: []*types.DataType{types.TextType, types.TextType},
		Values:      [][]any{{"1", "2"}, {"3", "4"}},
	},
},
	nil, "text")
Output:

| a | b |
+---+---+
| 1 | 2 |
| 3 | 4 |

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatByteEncoding

func FormatByteEncoding(b []byte) string

FormatByteEncoding formats bytes to be read on the CLI.

func NewCmdDatabase

func NewCmdDatabase() *cobra.Command

Types

type NamedParameter

type NamedParameter struct {
	Name string
	Type *types.DataType
}

func GetParamList

func GetParamList(ctx context.Context,
	query func(ctx context.Context, query string, args map[string]any) (*types.QueryResult, error),
	namespace, action string) ([]NamedParameter, error)

Jump to

Keyboard shortcuts

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