mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 20:07:51 +00:00
find string in slice
This commit is contained in:
parent
a80be54a60
commit
c47fffebd3
1 changed files with 5 additions and 8 deletions
|
|
@ -202,13 +202,10 @@ func (a *Action) Validate() error {
|
|||
if a.Frame == "" {
|
||||
return ErrFrameRequired
|
||||
}
|
||||
validValues := make(map[string]bool)
|
||||
for _, val := range validValueDestination {
|
||||
validValues[val] = true
|
||||
}
|
||||
if _, ok := validValues[a.ValueDestination]; !ok {
|
||||
if !foundItem(validValueDestination, a.ValueDestination) {
|
||||
return fmt.Errorf("invalid ValueDestination: %s", a.ValueDestination)
|
||||
}
|
||||
|
||||
switch a.ValueDestination {
|
||||
case InputMapping:
|
||||
if len(a.ValueMap) == 0 {
|
||||
|
|
@ -228,7 +225,7 @@ func (a *Action) Encode() *internal.InputDefinitionAction {
|
|||
}
|
||||
}
|
||||
|
||||
// convert pointer to uint64
|
||||
// convert pointer to uint64.
|
||||
func convert(x *uint64) uint64 {
|
||||
if x != nil {
|
||||
return *x
|
||||
|
|
@ -242,7 +239,7 @@ type InputFrame struct {
|
|||
Options FrameOptions `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// Validate the InputFrame data
|
||||
// Validate the InputFrame data.
|
||||
func (i *InputFrame) Validate() error {
|
||||
if err := ValidateName(i.Name); err != nil {
|
||||
return err
|
||||
|
|
@ -265,7 +262,7 @@ type InputDefinitionInfo struct {
|
|||
Fields []InputDefinitionField `json:"fields"`
|
||||
}
|
||||
|
||||
// Validate the InputDefinitionInfo data
|
||||
// Validate the InputDefinitionInfo data.
|
||||
func (i *InputDefinitionInfo) Validate(columnLabel string) error {
|
||||
numPrimaryKey := 0
|
||||
accountRowID := make(map[string]uint64)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue