dataset

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFailedToParseCSVorTSVFile _
	ErrFailedToParseCSVorTSVFile error = errors.New("failed to parse file content")
	// ErrIncompatibleSchema _
	ErrIncompatibleSchema error = errors.New("schema is not compatible with csv")
	// ErrDuplicatiedNameFields _
	ErrDuplicatiedNameFields error = errors.New("failed to parse, name-duplicated fields")
)

Functions

This section is empty.

Types

type Builder

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

Builder _

func New

func New() *Builder

New _

func (*Builder) Build

func (b *Builder) Build() (*Dataset, error)

Build _

func (*Builder) Fields

func (b *Builder) Fields(fields []*Field) *Builder

Fields _

func (*Builder) ID

func (b *Builder) ID(id id.DatasetID) *Builder

ID _

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Dataset

MustBuild _

func (*Builder) NewID

func (b *Builder) NewID() *Builder

NewID _

func (*Builder) Scene

func (b *Builder) Scene(scene id.SceneID) *Builder

Scene _

func (*Builder) Schema

func (b *Builder) Schema(schema id.DatasetSchemaID) *Builder

Schema _

func (*Builder) Source

func (b *Builder) Source(source Source) *Builder

Source _

type Dataset

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

Dataset _

func (*Dataset) Field

func (d *Dataset) Field(id id.DatasetSchemaFieldID) *Field

Field _

func (*Dataset) FieldBySource

func (d *Dataset) FieldBySource(source Source) *Field

FieldBySource _

func (*Dataset) FieldByType

func (d *Dataset) FieldByType(t ValueType) *Field

FieldByType _

func (*Dataset) FieldRef

func (d *Dataset) FieldRef(id *id.DatasetSchemaFieldID) *Field

FieldRef _

func (*Dataset) Fields

func (d *Dataset) Fields() []*Field

Fields _

func (*Dataset) ID

func (d *Dataset) ID() (i id.DatasetID)

ID _

func (*Dataset) NameField

func (d *Dataset) NameField(ds *Schema) *Field

NameField _

func (*Dataset) Scene

func (d *Dataset) Scene() (i id.SceneID)

Scene _

func (*Dataset) Schema

func (d *Dataset) Schema() (i id.DatasetSchemaID)

Schema _

func (*Dataset) Source

func (d *Dataset) Source() (i Source)

Source _

type DatasetCSVParser

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

func NewCSVParser

func NewCSVParser(r io.Reader, n string, seperator rune) *DatasetCSVParser

func (*DatasetCSVParser) CheckCompatible

func (p *DatasetCSVParser) CheckCompatible(s *Schema) error

func (*DatasetCSVParser) GuessSchema

func (p *DatasetCSVParser) GuessSchema(sid id.SceneID) error

func (*DatasetCSVParser) Init

func (p *DatasetCSVParser) Init() error

func (*DatasetCSVParser) ReadAll

func (p *DatasetCSVParser) ReadAll() (*Schema, []*Dataset, error)

type Diff

type Diff struct {
	Added   List
	Removed List
	Others  map[id.DatasetID]*Dataset
}

Diff _

type Field

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

Field _

func NewField

func NewField(field id.DatasetSchemaFieldID, value *Value, source Source) *Field

NewField _

func (*Field) Field

func (d *Field) Field() (i id.DatasetSchemaFieldID)

Field _

func (*Field) FieldRef

func (d *Field) FieldRef() *id.DatasetSchemaFieldID

FieldRef _

func (*Field) Source

func (d *Field) Source() (s Source)

Source _

func (*Field) Type

func (d *Field) Type() (v ValueType)

Type _

func (*Field) Value

func (d *Field) Value() *Value

Value _

type GraphIterator

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

GraphIterator は、データセットをグラフ探索するためのイテレータです。

func GraphIteratorFrom

func GraphIteratorFrom(root id.DatasetID, depth int) *GraphIterator

GraphIteratorFrom _

func (*GraphIterator) Next

func (di *GraphIterator) Next(d *Dataset) (id.DatasetID, bool)

Next _

func (*GraphIterator) Result

func (di *GraphIterator) Result() Map

Result _

type GraphLoader

type GraphLoader func(context.Context, id.DatasetID, ...id.DatasetSchemaFieldID) (List, *Field, error)

func GraphLoaderFromMap

func GraphLoaderFromMap(m Map) GraphLoader

func GraphLoaderFromMapAndGraph

func GraphLoaderFromMapAndGraph(m Map, g GraphLoader) GraphLoader

type LatLng

type LatLng struct {
	Lat float64 `mapstructure:"lat"`
	Lng float64 `mapstructure:"lng"`
}

LatLng _

func LatLngFrom

func LatLngFrom(m interface{}) (LatLng, bool)

LatLngFrom _

type LatLngHeight

type LatLngHeight struct {
	Lat    float64 `mapstructure:"lat"`
	Lng    float64 `mapstructure:"lng"`
	Height float64 `mapstructure:"height"`
}

LatLngHeight _

func LatLngHeightFrom

func LatLngHeightFrom(m interface{}) (LatLngHeight, bool)

LatLngHeightFrom _

type List

type List []*Dataset

List _

func (List) DiffBySource

func (l List) DiffBySource(l2 List) Diff

DiffBySource _

func (List) FilterByDatasetSchema

func (l List) FilterByDatasetSchema(s id.DatasetSchemaID) List

FilterByDatasetSchema _

func (List) FindDataset

func (l List) FindDataset(id id.DatasetID) *Dataset

FindDataset _

func (List) FindDatasetBySource

func (l List) FindDatasetBySource(s Source) *Dataset

FindDatasetBySource _

func (List) First

func (l List) First() *Dataset

First _

func (List) GraphLoader

func (l List) GraphLoader() GraphLoader

func (List) Last

func (l List) Last() *Dataset

Last _

func (List) Loader

func (l List) Loader() Loader

func (List) Map

func (l List) Map() Map

Map _

func (List) ToDatasetIds

func (l List) ToDatasetIds() []id.DatasetID

ToDatasetIds _

type Loader

type Loader func(context.Context, ...id.DatasetID) (List, error)

func LoaderFrom

func LoaderFrom(data []*Dataset) Loader

func LoaderFromMap

func LoaderFromMap(data map[id.DatasetID]*Dataset) Loader

type Map

type Map map[id.DatasetID]*Dataset

Map _

func (Map) Add

func (dm Map) Add(dss ...*Dataset)

Add _

func (Map) GraphLoader

func (dm Map) GraphLoader() GraphLoader

func (Map) GraphSearchByFields

func (dm Map) GraphSearchByFields(root id.DatasetID, fields ...id.DatasetSchemaFieldID) (List, *Field)

GraphSearchByFields _

func (Map) Loader

func (dm Map) Loader() Loader

func (Map) Slice

func (dm Map) Slice() List

Slice _

type Schema

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

Schema _

func (*Schema) Dynamic

func (d *Schema) Dynamic() bool

Dynamic _

func (*Schema) Field

func (d *Schema) Field(id id.DatasetSchemaFieldID) *SchemaField

Field _

func (*Schema) FieldBySource

func (d *Schema) FieldBySource(source Source) *SchemaField

FieldBySource _

func (*Schema) FieldByType

func (d *Schema) FieldByType(t ValueType) *SchemaField

FieldByType _

func (*Schema) FieldDiffBySource

func (d *Schema) FieldDiffBySource(d2 *Schema) SchemaFieldDiff

FieldDiffBySource _

func (*Schema) FieldRef

func (d *Schema) FieldRef(id *id.DatasetSchemaFieldID) *SchemaField

FieldRef _

func (*Schema) Fields

func (d *Schema) Fields() []*SchemaField

Fields _

func (*Schema) ID

func (d *Schema) ID() (i id.DatasetSchemaID)

ID _

func (*Schema) IDRef

func (d *Schema) IDRef() *id.DatasetSchemaID

IDRef _

func (*Schema) Name

func (d *Schema) Name() string

Name _

func (*Schema) Rename

func (u *Schema) Rename(name string)

Rename _

func (*Schema) RepresentativeField

func (d *Schema) RepresentativeField() *SchemaField

RepresentativeField _

func (*Schema) RepresentativeFieldID

func (d *Schema) RepresentativeFieldID() *id.DatasetSchemaFieldID

RepresentativeFieldID _

func (*Schema) Scene

func (d *Schema) Scene() (i id.SceneID)

Scene _

func (*Schema) Source

func (d *Schema) Source() (s Source)

Source _

type SchemaBuilder

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

SchemaBuilder _

func NewSchema

func NewSchema() *SchemaBuilder

NewSchema _

func (*SchemaBuilder) Build

func (b *SchemaBuilder) Build() (*Schema, error)

Build _

func (*SchemaBuilder) Dynamic

func (b *SchemaBuilder) Dynamic(dynamic bool) *SchemaBuilder

Dynamic _

func (*SchemaBuilder) Fields

func (b *SchemaBuilder) Fields(fields []*SchemaField) *SchemaBuilder

Fields _

func (*SchemaBuilder) ID

ID _

func (*SchemaBuilder) MustBuild

func (b *SchemaBuilder) MustBuild() *Schema

MustBuild _

func (*SchemaBuilder) Name

func (b *SchemaBuilder) Name(name string) *SchemaBuilder

Name _

func (*SchemaBuilder) NewID

func (b *SchemaBuilder) NewID() *SchemaBuilder

NewID _

func (*SchemaBuilder) RepresentativeField

func (b *SchemaBuilder) RepresentativeField(representativeField id.DatasetSchemaFieldID) *SchemaBuilder

RepresentativeField _

func (*SchemaBuilder) Scene

func (b *SchemaBuilder) Scene(scene id.SceneID) *SchemaBuilder

Scene _

func (*SchemaBuilder) Source

func (b *SchemaBuilder) Source(source Source) *SchemaBuilder

Source _

type SchemaField

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

SchemaField _

func (*SchemaField) ID

func (d *SchemaField) ID() (i id.DatasetSchemaFieldID)

ID _

func (*SchemaField) IDRef

func (d *SchemaField) IDRef() *id.DatasetSchemaFieldID

IDRef _

func (*SchemaField) Name

func (d *SchemaField) Name() (n string)

Name _

func (*SchemaField) Ref

func (d *SchemaField) Ref() *id.DatasetSchemaID

Ref _

func (*SchemaField) Source

func (d *SchemaField) Source() (s Source)

Source _

func (*SchemaField) Type

func (d *SchemaField) Type() (v ValueType)

Type _

type SchemaFieldBuilder

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

SchemaFieldBuilder _

func NewSchemaField

func NewSchemaField() *SchemaFieldBuilder

NewSchemaField _

func (*SchemaFieldBuilder) Build

func (b *SchemaFieldBuilder) Build() (*SchemaField, error)

Build _

func (*SchemaFieldBuilder) ID

ID _

func (*SchemaFieldBuilder) MustBuild

func (b *SchemaFieldBuilder) MustBuild() *SchemaField

MustBuild _

func (*SchemaFieldBuilder) Name

Name _

func (*SchemaFieldBuilder) NewID

NewID _

func (*SchemaFieldBuilder) Ref

Ref _

func (*SchemaFieldBuilder) Source

func (b *SchemaFieldBuilder) Source(source Source) *SchemaFieldBuilder

Source _

func (*SchemaFieldBuilder) Type

func (b *SchemaFieldBuilder) Type(dataType ValueType) *SchemaFieldBuilder

Type _

type SchemaFieldDiff

type SchemaFieldDiff struct {
	Added    []*SchemaField
	Removed  []*SchemaField
	Replaced map[id.DatasetSchemaFieldID]*SchemaField
}

SchemaFieldDiff _

type SchemaGraphIterator

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

SchemaGraphIterator は、データセットをグラフ探索するためのイテレータです。

func SchemaGraphIteratorFrom

func SchemaGraphIteratorFrom(root id.DatasetSchemaID, depth int) *SchemaGraphIterator

SchemaGraphIteratorFrom _

func (*SchemaGraphIterator) Next

Next _

func (*SchemaGraphIterator) Result

func (di *SchemaGraphIterator) Result() SchemaMap

Result _

type SchemaList

type SchemaList []*Schema

SchemaList _

func (SchemaList) Map

func (dsl SchemaList) Map() SchemaMap

Map _

type SchemaMap

type SchemaMap map[id.DatasetSchemaID]*Schema

SchemaMap _

func (SchemaMap) GraphSearchByFields

func (dsm SchemaMap) GraphSearchByFields(root id.DatasetSchemaID, fields ...id.DatasetSchemaFieldID) (SchemaList, *SchemaField)

GraphSearchByFields _

func (SchemaMap) Slice

func (dsm SchemaMap) Slice() SchemaList

Slice _

type Source

type Source string

Source _

func (Source) String

func (d Source) String() string

String implements Stringer

type Value

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

Value _

func ValueFrom

func ValueFrom(v interface{}) *Value

ValueFrom _

func (*Value) Clone

func (v *Value) Clone() *Value

Clone _

func (*Value) Interface

func (v *Value) Interface() interface{}

Interface converts the value into generic representation

func (*Value) Type

func (v *Value) Type() ValueType

Type _

func (*Value) Value

func (v *Value) Value() interface{}

Value _

func (*Value) ValueBool

func (v *Value) ValueBool() *bool

ValueBool _

func (*Value) ValueLatLng

func (v *Value) ValueLatLng() *LatLng

ValueLatLng _

func (*Value) ValueLatLngHeight

func (v *Value) ValueLatLngHeight() *LatLngHeight

ValueLatLngHeight _

func (*Value) ValueNumber

func (v *Value) ValueNumber() *float64

ValueNumber _

func (*Value) ValueRef

func (v *Value) ValueRef() *id.ID

ValueRef _

func (*Value) ValueString

func (v *Value) ValueString() *string

ValueString _

func (*Value) ValueURL

func (v *Value) ValueURL() *url.URL

ValueURL _

type ValueType

type ValueType string

ValueType _

const (
	// ValueTypeBool _
	ValueTypeBool ValueType = "bool"
	// ValueTypeNumber _
	ValueTypeNumber ValueType = "number"
	// ValueTypeString _
	ValueTypeString ValueType = "string"
	// ValueTypeRef _
	ValueTypeRef ValueType = "ref"
	// ValueTypeURL _
	ValueTypeURL ValueType = "url"
	// ValueTypeLatLng _
	ValueTypeLatLng ValueType = "latlng"
	// ValueTypeLatLngHeight _
	ValueTypeLatLngHeight ValueType = "latlngheight"
)

func ValueTypeFrom

func ValueTypeFrom(t string) (ValueType, bool)

ValueTypeFrom _

func (ValueType) Validate

func (t ValueType) Validate() (ValueType, bool)

Validate _

func (ValueType) ValidateValue

func (t ValueType) ValidateValue(v *Value) bool

ValidateValue _

func (ValueType) ValueFrom

func (t ValueType) ValueFrom(v interface{}) *Value

ValueFrom _

Jump to

Keyboard shortcuts

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