s3select

package
v0.0.0-...-b3b3296 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorMessage

func NewErrorMessage(errorCode, errorMessage string) []byte

NewErrorMessage - creates new Request Level Error Message specified in https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html.

Types

type CompressionType

type CompressionType string

CompressionType - represents value inside <CompressionType/> in request XML.

func (*CompressionType) UnmarshalXML

func (c *CompressionType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML - decodes XML data.

type InputSerialization

type InputSerialization struct {
	CompressionType CompressionType    `xml:"CompressionType"`
	CSVArgs         csv.ReaderArgs     `xml:"CSV"`
	JSONArgs        json.ReaderArgs    `xml:"JSON"`
	ParquetArgs     parquet.ReaderArgs `xml:"Parquet"`
	// contains filtered or unexported fields
}

InputSerialization - represents elements inside <InputSerialization/> in request XML.

func (*InputSerialization) IsEmpty

func (input *InputSerialization) IsEmpty() bool

IsEmpty - returns whether input serialization is empty or not.

func (*InputSerialization) UnmarshalXML

func (input *InputSerialization) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML - decodes XML data.

type ObjectReadSeekCloser

type ObjectReadSeekCloser struct {
	// contains filtered or unexported fields
}

ObjectReadSeekCloser implements ReadSeekCloser interface for reading objects. It uses a function that returns a io.ReadCloser for the object.

func NewObjectReadSeekCloser

func NewObjectReadSeekCloser(segmentReader ObjectSegmentReaderFn, actualSize int64) *ObjectReadSeekCloser

NewObjectReadSeekCloser creates a new ObjectReadSeekCloser.

func (*ObjectReadSeekCloser) Close

func (rsc *ObjectReadSeekCloser) Close() error

Close call to implement io.Closer. Calling Read/Seek after Close reopens the object for reading and a subsequent Close call is required to ensure resources are freed.

func (*ObjectReadSeekCloser) Read

func (rsc *ObjectReadSeekCloser) Read(p []byte) (n int, err error)

Read call to implement io.Reader

func (*ObjectReadSeekCloser) Seek

func (rsc *ObjectReadSeekCloser) Seek(offset int64, whence int) (int64, error)

Seek call to implement io.Seeker

type ObjectSegmentReaderFn

type ObjectSegmentReaderFn func(offset int64) (io.ReadCloser, error)

ObjectSegmentReaderFn is a function that returns a reader for a contiguous suffix segment of an object starting at the given (non-negative) offset.

type OutputSerialization

type OutputSerialization struct {
	CSVArgs  csv.WriterArgs  `xml:"CSV"`
	JSONArgs json.WriterArgs `xml:"JSON"`
	// contains filtered or unexported fields
}

OutputSerialization - represents elements inside <OutputSerialization/> in request XML.

func (*OutputSerialization) IsEmpty

func (output *OutputSerialization) IsEmpty() bool

IsEmpty - returns whether output serialization is empty or not.

func (*OutputSerialization) UnmarshalXML

func (output *OutputSerialization) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML - decodes XML data.

type RequestProgress

type RequestProgress struct {
	Enabled bool `xml:"Enabled"`
}

RequestProgress - represents elements inside <RequestProgress/> in request XML.

type S3Select

type S3Select struct {
	XMLName        xml.Name            `xml:"SelectRequest"`
	Expression     string              `xml:"Expression"`
	ExpressionType string              `xml:"ExpressionType"`
	Input          InputSerialization  `xml:"InputSerialization"`
	Output         OutputSerialization `xml:"OutputSerialization"`
	Progress       RequestProgress     `xml:"RequestProgress"`
	ScanRange      *ScanRange          `xml:"ScanRange"`
	// contains filtered or unexported fields
}

S3Select - filters the contents on a simple structured query language (SQL) statement. It represents elements inside <SelectRequest/> in request XML specified in detail at https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html.

func NewS3Select

func NewS3Select(r io.Reader) (*S3Select, error)

NewS3Select - creates new S3Select by given request XML reader.

func (*S3Select) Close

func (s3Select *S3Select) Close() error

Close - closes opened S3 object.

func (*S3Select) Evaluate

func (s3Select *S3Select) Evaluate(w http.ResponseWriter)

Evaluate - filters and sends records read from opened reader as per select statement to http response writer.

func (*S3Select) Open

func (s3Select *S3Select) Open(rsc io.ReadSeekCloser) error

Open - opens S3 object by using callback for SQL selection query. Currently CSV, JSON and Apache Parquet formats are supported.

func (*S3Select) UnmarshalXML

func (s3Select *S3Select) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML - decodes XML data.

type ScanRange

type ScanRange struct {
	// Start is the byte offset to read from (from the start of the file).
	Start *uint64 `xml:"Start"`
	// End is the offset of the last byte that should be returned when Start
	// is set, otherwise it is the offset from EOF to start reading.
	End *uint64 `xml:"End"`
}

ScanRange represents the ScanRange parameter.

func (*ScanRange) StartLen

func (s *ScanRange) StartLen() (start, length int64, err error)

StartLen returns start offset plus length from range.

func (*ScanRange) Validate

func (s *ScanRange) Validate() error

Validate if the scan range is valid.

type SelectError

type SelectError interface {
	Cause() error
	ErrorCode() string
	ErrorMessage() string
	HTTPStatusCode() int
	Error() string
}

SelectError - represents s3 select error specified in https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html#RESTObjectSELECTContent-responses-special-errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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