glueschema

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCommentLength = 255

MaxCommentLength is the maximum size of column comments allowed by Glue

Variables

View Source
var TruncateComments = true

TruncateComments is a flag used to allow mage to disable comment truncation during mage:doc

Functions

func ColumnName

func ColumnName(name string) string

ColumnName normalizes names to be used for Glue table columns

func MustRegisterMapping

func MustRegisterMapping(from reflect.Type, to Type)

func RegisterMapping

func RegisterMapping(from reflect.Type, to Type) error

Types

type Column

type Column struct {
	// Name is the name of the colunm
	Name string
	// Type is the glue schema type for the column.
	Type Type // this is the Glue type
	// Comment is used to set the comment in the glue column and also to set the
	// field description in generated documentation.
	Comment string
	// Required marks the column as required.
	// This information is used in documentation to mark fields as required.
	// It does not affect Glue schema in some way and this should be removed once
	// doc generation evolves to not use []glueschema.Column as input.
	Required bool
}

Column is a table column in AWS Glue. We are using a separate struct from glue.Column to be able to mark the column as required

func InferColumns

func InferColumns(schema interface{}) ([]Column, error)

func InferColumnsCustom

func InferColumnsCustom(schema interface{}, custom func(reflect.Type) Type) ([]Column, error)

func InferColumnsWithMappings

func InferColumnsWithMappings(schema interface{}) ([]Column, map[string]string, error)

type Type

type Type string

Type is a string representing a type in Glue schema

const (
	TypeString    Type = "string"
	TypeBool      Type = "boolean"
	TypeTimestamp Type = "timestamp"
	TypeTinyInt   Type = "tinyint"
	TypeSmallInt  Type = "smallint"
	TypeInt       Type = "int"
	TypeBigInt    Type = "bigint"
	TypeDouble    Type = "double"
	TypeFloat     Type = "float"
)

Scalar types

func ArrayOf

func ArrayOf(typ Type) Type

func MapOf

func MapOf(key, typ Type) Type

func StructOf

func StructOf(cols []Column) Type

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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