mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
change Field to InputDefinitionField
This commit is contained in:
parent
aa2cc13a9c
commit
9229d772e9
1 changed files with 8 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ type InputDefinition struct {
|
|||
index string
|
||||
broadcaster Broadcaster
|
||||
frames []InputFrame
|
||||
fields []Field
|
||||
fields []InputDefinitionField
|
||||
}
|
||||
|
||||
// NewInputDefinition returns a new instance of InputDefinition.
|
||||
|
|
@ -61,7 +61,7 @@ func NewInputDefinition(path, index, name string) (*InputDefinition, error) {
|
|||
func (i *InputDefinition) Frames() []InputFrame { return i.frames }
|
||||
|
||||
// Fields returns fields of the input definition was initialized with.
|
||||
func (i *InputDefinition) Fields() []Field { return i.fields }
|
||||
func (i *InputDefinition) Fields() []InputDefinitionField { return i.fields }
|
||||
|
||||
// Open opens and initializes the InputDefinition from file.
|
||||
func (i *InputDefinition) Open() error {
|
||||
|
|
@ -130,7 +130,7 @@ func (i *InputDefinition) LoadDefinition(pb *internal.InputDefinition) error {
|
|||
return errors.New("duplicate primaryKey with other field")
|
||||
}
|
||||
|
||||
inputField := Field{
|
||||
inputField := InputDefinitionField{
|
||||
Name: field.Name,
|
||||
PrimaryKey: field.PrimaryKey,
|
||||
Actions: actions,
|
||||
|
|
@ -210,15 +210,15 @@ func (i *InputDefinition) saveMeta() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Field descripes a single field mapping in the InputDefinition.
|
||||
type Field struct {
|
||||
// InputDefinitionField descripes a single field mapping in the InputDefinition.
|
||||
type InputDefinitionField struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
PrimaryKey bool `json:"primaryKey,omitempty"`
|
||||
Actions []Action `json:"actions,omitempty"`
|
||||
}
|
||||
|
||||
// Encode converts Field into its internal representation.
|
||||
func (o *Field) Encode() (*internal.InputDefinitionField, error) {
|
||||
// Encode converts InputDefinitionField into its internal representation.
|
||||
func (o *InputDefinitionField) Encode() (*internal.InputDefinitionField, error) {
|
||||
field := internal.InputDefinitionField{Name: o.Name, PrimaryKey: o.PrimaryKey}
|
||||
|
||||
for _, action := range o.Actions {
|
||||
|
|
@ -268,7 +268,7 @@ type InputFrame struct {
|
|||
// InputDefinitionInfo the json message format to create an InputDefinition.
|
||||
type InputDefinitionInfo struct {
|
||||
Frames []InputFrame `json:"frames"`
|
||||
Fields []Field `json:"fields"`
|
||||
Fields []InputDefinitionField `json:"fields"`
|
||||
}
|
||||
|
||||
// Encode converts InputDefinitionInfo into its internal representation.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue