datafile

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	CSV  = "csv"
	SQL  = "sql"
	TEXT = "text"
)
View Source
const (
	DESCRIPTOR_PATH = "/metainfo/dataFileDescriptor.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvDataFile

type CsvDataFile struct {
	Delimiter  string
	Header     string
	QuoteChar  string
	EscapeChar string
	DataFile
	// contains filtered or unexported fields
}

func (*CsvDataFile) Close

func (df *CsvDataFile) Close()

func (*CsvDataFile) GetBytesRead

func (df *CsvDataFile) GetBytesRead() int64

func (*CsvDataFile) GetHeader

func (df *CsvDataFile) GetHeader() string

func (*CsvDataFile) NextLine

func (df *CsvDataFile) NextLine() (string, error)

func (*CsvDataFile) ResetBytesRead

func (df *CsvDataFile) ResetBytesRead()

func (*CsvDataFile) SkipLines

func (df *CsvDataFile) SkipLines(numLines int64) error

type DataFile

type DataFile interface {
	SkipLines(numLines int64) error
	NextLine() (string, error)
	GetBytesRead() int64
	ResetBytesRead()
	GetHeader() string
	Close()
}

func NewDataFile added in v1.2.0

func NewDataFile(fileName string, reader io.ReadCloser, descriptor *Descriptor) (DataFile, error)

type Descriptor

type Descriptor struct {
	FileFormat                 string              `json:"FileFormat"`
	Delimiter                  string              `json:"Delimiter"`
	HasHeader                  bool                `json:"HasHeader"`
	ExportDir                  string              `json:"-"`
	QuoteChar                  byte                `json:"QuoteChar,omitempty"`
	EscapeChar                 byte                `json:"EscapeChar,omitempty"`
	NullString                 string              `json:"NullString,omitempty"`
	DataFileList               []*FileEntry        `json:"FileList"`
	TableNameToExportedColumns map[string][]string `json:"TableNameToExportedColumns"`
}

func OpenDescriptor

func OpenDescriptor(exportDir string) *Descriptor

func (*Descriptor) GetDataFileEntryByTableName added in v1.6.0

func (dfd *Descriptor) GetDataFileEntryByTableName(tableName string) *FileEntry

func (*Descriptor) GetFileEntry added in v1.4.0

func (dfd *Descriptor) GetFileEntry(filePath, tableName string) *FileEntry

func (*Descriptor) Save

func (dfd *Descriptor) Save()

type FileEntry added in v1.4.0

type FileEntry struct {
	// The in-memory Descriptor MUST always have absolute paths.
	// If the on-disk JSON file has relative file-paths, they are converted to
	// absolute paths when the JSON file is loaded.
	FilePath string `json:"FilePath"`
	// Case sensitive table names and reserved words used as table names are quoted.
	// If the `TableName` doesn't have schema name, it is assumed to be the "public" schema.
	TableName string `json:"TableName"`
	// The number of rows in the file.
	// In case of `import data file` the number of rows in the file is not known upfront.
	// In that case, this field is set to -1.
	RowCount int64 `json:"RowCount"`
	FileSize int64 `json:"FileSize"`
}

type SqlDataFile

type SqlDataFile struct {
	DataFile
	// contains filtered or unexported fields
}

func (*SqlDataFile) Close

func (df *SqlDataFile) Close()

func (*SqlDataFile) GetBytesRead

func (df *SqlDataFile) GetBytesRead() int64

func (*SqlDataFile) NextLine

func (df *SqlDataFile) NextLine() (string, error)

func (*SqlDataFile) ResetBytesRead

func (df *SqlDataFile) ResetBytesRead()

func (*SqlDataFile) SkipLines

func (df *SqlDataFile) SkipLines(numLines int64) error

type TextDataFile added in v1.0.0

type TextDataFile struct {
	Delimiter string
	Header    string
	DataFile
	// contains filtered or unexported fields
}

func (*TextDataFile) Close added in v1.0.0

func (df *TextDataFile) Close()

func (*TextDataFile) GetBytesRead added in v1.0.0

func (df *TextDataFile) GetBytesRead() int64

func (*TextDataFile) GetHeader added in v1.0.0

func (df *TextDataFile) GetHeader() string

func (*TextDataFile) NextLine added in v1.0.0

func (df *TextDataFile) NextLine() (string, error)

func (*TextDataFile) ResetBytesRead added in v1.0.0

func (df *TextDataFile) ResetBytesRead()

func (*TextDataFile) SkipLines added in v1.0.0

func (df *TextDataFile) SkipLines(numLines int64) error

Jump to

Keyboard shortcuts

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