tablefq

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tablefq is a tiny package that holds the tablefq.T type, which is a fully-qualified SQL table name. This package is an experiment, and may be changed or removed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any interface {
	string | T
}

Any is a type constraint for a table name, which can be a string (just the table name without catalog or schema) or a fully-qualified T.

REVISIT: Probably get rid of tablefq.Any, if it's only used in one place.

type T

type T struct {
	// Catalog is the database, e.g. "sakila".
	Catalog string

	// Schema is the namespace, e.g. "public".
	Schema string

	// Table is the table name, e.g. "actor".
	Table string
}

T is a fully-qualified table name, of the form CATALOG.SCHEMA.NAME, e.g. "sakila"."public"."actor".

func From

func From[X Any](t X) T

From returns a T from an Any, which can be either a string (just the table name) or a fully-qualified table, including catalog, schema, and table name.

func New

func New(tbl string) T

New returns a new tablefq.T with the given T.Table value, and empty T.Catalog and T.Schema values.

func (T) Render

func (t T) Render(quoteFn func(s string) string) string

Render renders t using quoteFn, e.g. stringz.DoubleQuote.

func (T) String

func (t T) String() string

String returns a default representation of t using stringz.DoubleQuote for the components. Use T.Render to control the output format.

Jump to

Keyboard shortcuts

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