// Gets a custom non-reserved property from this schemafield and a bool representing if it exists.
424344
func (this *SchemaField) Prop(key string) (interface{}, bool) {
	if this.Properties != nil {
		if prop, ok := this.Properties[key]; ok {
			return prop, true
		}
	}
	return nil, false
}
667246
func (t *TextMatch) GetProperty() string {
	if t == nil || t.Property == nil {
		return ""
	}
	return *t.Property
}
63482
func (m *GenericParser) getProperty(mapKey reflect.Value) (Property, error) {
	properteerType := reflect.TypeOf(new(Properteer)).Elem()
	stringerType := reflect.TypeOf(new(fmt.Stringer)).Elem()

	// if mapKey implements the pdk.Properteer interface, use that.
	if k2, ok := anyImplements(mapKey, properteerType); ok {
		return k2.Interface().(Properteer).Property(), nil
	}
	// if mapKey implements fmt.Stringer, use that.
	if k2, ok := anyImplements(mapKey, stringerType); ok {
		return Property(k2.Interface().(fmt.Stringer).String()), nil
	}

	// Otherwise, handle all comparable types (see https://golang.org/ref/spec#Comparison_operators):
	mapKey = deref(mapKey)
	switch k := mapKey.Kind(); k {
	case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
		return Property(fmt.Sprintf("%v", mapKey)), nil
	case reflect.Chan:
		m.Stats.Count("parser.getProperty.Chan", 1, 1)
		return "", errors.New("channel cannot be converted to property")
	case reflect.Array:
		m.Stats.Count("parser.getProperty."+k.String(), 1, 1)
		return "", errors.New("array cannot be converted to property")
	case reflect.Struct:
		m.Stats.Count("parser.getProperty."+k.String(), 1, 1)
		return "", errors.New("struct cannot be converted to property")
	case reflect.Complex128, reflect.Complex64:
		m.Stats.Count("parser.getProperty."+k.String(), 1, 1)
		return "", errors.New("complex value cannot be converted to property")
	default:
		m.Stats.Count("parser.getProperty."+k.String(), 1, 1)
		return "", errors.Errorf("unexpected kind: %v mapKey: %v", mapKey.Kind(), mapKey)
	}
}
567114
func GetInfoSchema(ctx sessionctx.Context) infoschema.InfoSchema {
	sessVar := ctx.GetSessionVars()
	var is infoschema.InfoSchema
	if snap := sessVar.SnapshotInfoschema; snap != nil {
		is = snap.(infoschema.InfoSchema)
		logutil.Logger(context.Background()).Info("use snapshot schema", zap.Uint64("conn", sessVar.ConnectionID), zap.Int64("schemaVersion", is.SchemaMetaVersion()))
	} else {
		is = sessVar.TxnCtx.InfoSchema.(infoschema.InfoSchema)
	}
	return is
}
1013270
func getProperty(n *structs.Node, property string) (string, bool) {
	if n == nil || property == "" {
		return "", false
	}

	val, ok := resolveTarget(property, n)
	if !ok {
		return "", false
	}
	nodeValue, ok := val.(string)
	if !ok {
		return "", false
	}

	return nodeValue, true
}
19907
func objectGetOwnProperty(self *_object, name string) *_property {
	// Return a _copy_ of the property
	property, exists := self._read(name)
	if !exists {
		return nil
	}
	return &property
}
932522
func (p *Provider) GetSchema(req *terraform.ProviderSchemaRequest) (*terraform.ProviderSchema, error) {
	resourceTypes := map[string]*configschema.Block{}
	dataSources := map[string]*configschema.Block{}

	for _, name := range req.ResourceTypes {
		if r, exists := p.ResourcesMap[name]; exists {
			resourceTypes[name] = r.CoreConfigSchema()
		}
	}
	for _, name := range req.DataSources {
		if r, exists := p.DataSourcesMap[name]; exists {
			dataSources[name] = r.CoreConfigSchema()
		}
	}

	return &terraform.ProviderSchema{
		Provider:      schemaMap(p.Schema).CoreConfigSchema(),
		ResourceTypes: resourceTypes,
		DataSources:   dataSources,
	}, nil
}
1218794
func (p *TypeProperties) IsNonPropertiesObject() bool {
	return (p.UnderlyingType == "object" && len(p.protoProperty.Properties) == 0)
}
1277884
func (c *APIContext) Get(key string) (value interface{}, exists bool) {
	if c.keys != nil {
		value, exists = c.keys[key]
	}
	return
}
1247529
func serializeProperties(props []datastore.Property, exists bool) ([]byte, error) {
	// NOTE: We use a separate exists bool to support nil-props for existing structs
	if !exists {
		return []byte{0, 0, 0, 0}, nil
	}

	buf := getBuffer()
	defer freeBuffer(buf)

	// Serialize the entity header
	header := serializeEntityHeader(len(props), entityExists)
	headerBytes := make([]byte, 4)
	binary.LittleEndian.PutUint32(headerBytes, header)
	buf.Write(headerBytes)

	// Serialize the properties
	for i := range props {
		if err := serializeProperty(buf, &props[i]); err != nil {
			return nil, err
		}
	}

	output := make([]byte, buf.Len())
	copy(output, buf.Bytes())
	return output, nil
}
200288
func (schema *Schema) schemaOrBooleanValue(v interface{}) *SchemaOrBoolean {
	schemaOrBoolean := &SchemaOrBoolean{}
	switch v := v.(type) {
	case bool:
		schemaOrBoolean.Boolean = &v
	case yaml.MapSlice:
		schemaOrBoolean.Schema = NewSchemaFromObject(v)
	default:
		fmt.Printf("schemaOrBooleanValue: unexpected type %T\n", v)
	case []map[string]interface{}:

	}
	return schemaOrBoolean
}
1239514
func (p *GRPCProvider) getSchema() providers.GetSchemaResponse {
	p.mu.Lock()
	// unlock inline in case GetSchema needs to be called
	if p.schemas.Provider.Block != nil {
		p.mu.Unlock()
		return p.schemas
	}
	p.mu.Unlock()

	// the schema should have been fetched already, but give it another shot
	// just in case things are being called out of order. This may happen for
	// tests.
	schemas := p.GetSchema()
	if schemas.Diagnostics.HasErrors() {
		panic(schemas.Diagnostics.Err())
	}

	return schemas
}
328506
func (ds *Dataset) GetProperty(property string) (string, error) {
	out, err := exec.Command("zfs", "get", "-H",
		"-o", "value",
		property, ds.Name).Output()
	if err != nil {
		return "", err
	}
	return strings.TrimSpace(string(out)), nil
}
595504
func (o *TypoToleranceOption) Get() (bool, string) {
	if o == nil {
		return true, ""
	}
	if o.value == typoToleranceTrue {
		return true, ""
	}
	if o.value == typoToleranceFalse {
		return false, ""
	}
	return false, o.value
}
776515
func (d *FieldData) getPrimitive(
	k string, schema *FieldSchema) (interface{}, bool, error) {
	raw, ok := d.Raw[k]
	if !ok {
		return nil, false, nil
	}

	switch schema.Type {
	case TypeBool:
		var result bool
		if err := mapstructure.Decode(raw, &result); err != nil {
			return nil, true, err
		}
		return result, true, nil

	case TypeInt:
		var result int
		if err := mapstructure.Decode(raw, &result); err != nil {
			return nil, true, err
		}
		return result, true, nil

	case TypeString:
		var result string
		if err := mapstructure.Decode(raw, &result); err != nil {
			return nil, true, err
		}
		return result, true, nil

	case TypeMap:
		var result map[string]interface{}
		if err := mapstructure.Decode(raw, &result); err != nil {
			return nil, true, err
		}
		return result, true, nil

	case TypeArray:
		var result []interface{}
		if err := mapstructure.Decode(raw, &result); err != nil {
			return nil, true, err
		}
		return result, true, nil

	default:
		panic(fmt.Sprintf("Unknown type: %s", schema.Type))
	}
}
1092812
func (client *Client) GetSchema(ctx context.Context, tablet *topodatapb.Tablet, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) {
	cc, c, err := client.dial(tablet)
	if err != nil {
		return nil, err
	}
	defer cc.Close()
	response, err := c.GetSchema(ctx, &tabletmanagerdatapb.GetSchemaRequest{
		Tables:        tables,
		ExcludeTables: excludeTables,
		IncludeViews:  includeViews,
	})
	if err != nil {
		return nil, err
	}
	return response.SchemaDefinition, nil
}
1262162
func (txn *Txn) getIndexValue(table, index string, args ...interface{}) (*IndexSchema, []byte, error) {
	// Get the table schema
	tableSchema, ok := txn.db.schema.Tables[table]
	if !ok {
		return nil, nil, fmt.Errorf("invalid table '%s'", table)
	}

	// Check for a prefix scan
	prefixScan := false
	if strings.HasSuffix(index, "_prefix") {
		index = strings.TrimSuffix(index, "_prefix")
		prefixScan = true
	}

	// Get the index schema
	indexSchema, ok := tableSchema.Indexes[index]
	if !ok {
		return nil, nil, fmt.Errorf("invalid index '%s'", index)
	}

	// Hot-path for when there are no arguments
	if len(args) == 0 {
		return indexSchema, nil, nil
	}

	// Special case the prefix scanning
	if prefixScan {
		prefixIndexer, ok := indexSchema.Indexer.(PrefixIndexer)
		if !ok {
			return indexSchema, nil,
				fmt.Errorf("index '%s' does not support prefix scanning", index)
		}

		val, err := prefixIndexer.PrefixFromArgs(args...)
		if err != nil {
			return indexSchema, nil, fmt.Errorf("index error: %v", err)
		}
		return indexSchema, val, err
	}

	// Get the exact match index
	val, err := indexSchema.Indexer.FromArgs(args...)
	if err != nil {
		return indexSchema, nil, fmt.Errorf("index error: %v", err)
	}
	return indexSchema, val, err
}