// Names returns a slice of field names. A struct tag with the content of "-"
// ignores the checking of that particular field. Example:
//
//   // Field is ignored by this package.
//   Field bool `structs:"-"`
//
// It panics if s's kind is not struct.
195019
func (s *Struct) Names() []string {
	fields := getFields(s.value, s.TagName)

	names := make([]string, len(fields))

	for i, field := range fields {
		names[i] = field.Name()
	}

	return names
}
1181926
func fieldAlias(field reflect.StructField, tagName string) (alias string, options tagOptions) {
	if tag := field.Tag.Get(tagName); tag != "" {
		alias, options = parseTag(tag)
	}
	if alias == "" {
		alias = field.Name
	}
	return alias, options
}
617571
func (sel *selector) names() string {
	bf := new(bytes.Buffer)

	switch parent := sel.parent.(type) {
	case nil, *atRule:
		for _, name := range strings.Split(sel.name, comma) {
			if bf.Len() > 0 {
				bf.WriteString(comma)
			}

			bf.WriteString(strings.TrimSpace(name))
		}
	case *selector:
		for _, parentS := range strings.Split(parent.names(), comma) {
			for _, s := range strings.Split(sel.name, comma) {
				if bf.Len() > 0 {
					bf.WriteString(comma)
				}

				s = strings.TrimSpace(s)

				if strings.Index(s, ampersand) != -1 {
					bf.WriteString(strings.Replace(s, ampersand, parentS, -1))
				} else {
					bf.WriteString(parentS)
					bf.WriteString(space)
					bf.WriteString(s)
				}
			}
		}
	}

	return bf.String()
}
1036693
func (g *Graph) AttrNames() []string {
	names := make([]string, 0, len(graphAttrs))
	for k := range graphAttrs {
		names = append(names, k)
	}
	sort.Strings(names)
	return names
}
1105214
func GetFieldNames(db *sql.DB, dbName string, tableName string) []string {
	fields := GetFields(db, dbName, tableName)
	if fields == nil {
		return nil
	}
	names := make([]string, len(fields))
	for i, f := range fields {
		names[i] = f.Name
	}
	return names
}
237510
func (db *Database) CollectionNames() (names []string, err error) {
	c := len(db.Name) + 1
	iter := db.C("system.namespaces").Find(nil).Iter()
	var result *struct{ Name string }
	for iter.Next(&result) {
		if strings.Index(result.Name, "$") < 0 || strings.Index(result.Name, ".oplog.$") >= 0 {
			names = append(names, result.Name[c:])
		}
	}
	if err := iter.Close(); err != nil {
		return nil, err
	}
	sort.Strings(names)
	return names, nil
}
778743
func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
	i, ok := sprops.decoderOrigNames[name]
	if ok {
		return i, sprops.Prop[i], true
	}
	return -1, nil, false
}
113561
func fieldName(x Expr) *Ident {
	switch t := x.(type) {
	case *Ident:
		return t
	case *SelectorExpr:
		if _, ok := t.X.(*Ident); ok {
			return t.Sel
		}
	case *StarExpr:
		return fieldName(t.X)
	}
	return nil
}
378663
func (e *RegisteredEntity) ColumnNames(fieldNames []string) ([]string, error) {
	if fieldNames == nil || len(fieldNames) == 0 {
		for _, field := range e.table.ColToField {
			fieldNames = append(fieldNames, field)
		}
	}
	columnNames := make([]string, len(fieldNames))
	for i, fieldName := range fieldNames {
		columnName, ok := e.table.FieldToCol[fieldName]
		if !ok {
			return nil, errors.Errorf("%s is not a valid field for %s", fieldName, e.table.StructName)
		}
		columnNames[i] = columnName
	}
	return columnNames, nil
}
598696
func getFieldNames(instance interface{}) []string {
	var (
		fields []string
		v      = reflect.Indirect(reflect.ValueOf(instance))
		t      = v.Type()
	)

	if t.Kind() != reflect.Struct {
		return nil
	}

	for i := 0; i < v.NumField(); i++ {
		var (
			vField = v.Field(i)
			tField = v.Type().Field(i)
		)

		// Is exportable?
		if tField.PkgPath != "" {
			continue
		}

		if tField.Type.Kind() == reflect.Struct && tField.Anonymous {
			fields = append(fields, getFieldNames(vField.Interface())...)
			continue
		}

		fields = append(fields, tField.Name)
	}

	return fields
}
305335
func fieldsOf(v interface{}, tagid string) (res []*StructField) {
	value := reflect.ValueOf(v).Elem()
	vType := value.Type()
	for i, n := 0, value.NumField(); i < n; i++ {
		value := value.Field(i)
		if !value.CanSet() {
			// Cannot set the field, maybe unexported.
			continue
		}
		field := vType.Field(i)
		fname := field.Name

		tag := field.Tag
		tagval := tag.Get(tagid)
		// The name is the first item in a coma separated list.
		switch v := strings.SplitN(tagval, ",", 2); v[0] {
		case "":
		case "-":
			continue
		default:
			// Set the field name according to the struct tag.
			fname = v[0]
		}

		var fs *StructStruct
		switch kind := value.Kind(); kind {
		case reflect.Invalid,
			reflect.Complex64, reflect.Complex128,
			reflect.Chan, reflect.Func, reflect.Interface,
			reflect.UnsafePointer:
			// Unsupported field types.
			continue
		case reflect.Struct:
			if field.Anonymous {
				// Embedded field: recursively descend into its fields.
				v := value.Addr().Interface()
				fs = &StructStruct{fname, v, value, fieldsOf(v, tagid)}
			}
		}
		res = append(res, &StructField{fname, &field, value, tag, fs})
	}
	return
}
205902
func (n *lowercaseSingularNamer) Name(t *types.Type) string {
	return strings.ToLower(t.Name.Name)
}
1362036
func (fiInfo *FieldInfo) Name() string {
	tagJSON := ucon.NewTagJSON(fiInfo.Base.Tag)
	name := tagJSON.Name()
	if name == "" {
		name = fiInfo.Base.Name
	}

	return name
}
139789
func (r *Reference) Tags(fn func(t Tag, value string)) {
	if fn == nil {
		return
	}
	fn(refNameTag, r.Name())
	fn(refLengthTag, fmt.Sprint(r.lRef))
	if r.assemID != "" {
		fn(assemblyIDTag, r.assemID)
	}
	if r.md5 != "" {
		fn(md5Tag, fmt.Sprintf("%x", []byte(r.md5)))
	}
	if r.species != "" {
		fn(speciesTag, r.species)
	}
	if r.uri != nil {
		fn(uriTag, r.uri.String())
	}
	for _, tp := range r.otherTags {
		fn(tp.tag, tp.value)
	}
}
884879
func tags(x interface{}) map[string]int {
	t := reflect.TypeOf(x)
	if t.Kind() == reflect.Ptr {
		t = t.Elem()
	}
	if t.Kind() != reflect.Struct {
		panic(errors.Errorf("expected struct, not %s", t))
	}

	if tagm := tagsForType[t]; tagm != nil {
		return tagm
	}
	panic(errors.Errorf("%s not found in type table", t))
}
148913
func (z *Zones) Names() []string {
	z.RLock()
	n := z.names
	z.RUnlock()
	return n
}
425504
func Names(withAliases bool) []string {
	out := []string{}
	for _, lexer := range Registry.Lexers {
		config := lexer.Config()
		out = append(out, config.Name)
		if withAliases {
			out = append(out, config.Aliases...)
		}
	}
	sort.Strings(out)
	return out
}