coal/helpers.go
func F(m Model, field string) string {
	// check if prefixed
	prefixed := strings.HasPrefix(field, "-")

	// remove prefix
	if prefixed {
		field = strings.TrimLeft(field, "-")
	}

	// find field
	f := Init(m).Meta().Fields[field]
	if f == nil {
		panic(fmt.Sprintf(`coal: field "%s" not found on "%s"`, field, m.Meta().Name))
	}

	// get field
	bsonField := f.BSONField

	// prefix field again
	if prefixed {
		bsonField = "-" + bsonField
	}

	return bsonField
}
func F(m Model, field string) string {
	// check if prefixed
	prefixed := strings.HasPrefix(field, "-")

	// remove prefix
	if prefixed {
		field = strings.TrimLeft(field, "-")
	}

	// find field
	f := Init(m).Meta().Fields[field]
	if f == nil {
		panic(fmt.Sprintf(`coal: field "%s" not found on "%s"`, field, m.Meta().Name))
	}

	// get field
	bsonField := f.BSONField

	// prefix field again
	if prefixed {
		bsonField = "-" + bsonField
	}

	return bsonField
}
// F is a short-hand function to extract the database BSON field name of a model
// field. Additionally, it supports the "-" prefix for retrieving sort keys.
//
// Note: F will panic if no field has been found.