// SelectFromStringsFromReader ...
488364
func SelectFromStringsFromReader(messageToPrint string, options []string, inputReader io.Reader) (string, error) {
	fmt.Printf("%s\n", messageToPrint)
	fmt.Println("Please select from the list:")
	for idx, anOption := range options {
		fmt.Printf("[%d] : %s\n", idx+1, anOption)
	}

	selectedOptionNum, err := AskForIntFromReader("(type in the option's number, then hit Enter)", inputReader)
	if err != nil {
		return "", err
	}

	if selectedOptionNum < 1 {
		return "", fmt.Errorf("invalid option: You entered a number less than 1")
	}
	if selectedOptionNum > int64(len(options)) {
		return "", fmt.Errorf("invalid option: You entered a number greater than the last option's number")
	}
	return options[selectedOptionNum-1], nil
}
449071
func NewFromString(endpoint string, client *http.Client) (*Client, error) {
	e, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	return New(e, client), nil
}
246664
func (c ReadableColumns) SelectString() string {
	var xs []string
	for _, t := range c.Cols {
		xs = append(xs, t.SelectSQL)
	}
	sort.Strings(xs)
	return strings.Join(xs, ", ")
}
367765
func ValueFromString(vt string) ValueType {
	switch vt {
	case "nil", "null":
		return NilType
	case "error":
		return ErrorType
	case "unknown":
		return UnknownType
	case "value":
		return ValueInterfaceType
	case "number":
		return NumberType
	case "int":
		return IntType
	case "bool":
		return BoolType
	case "time":
		return TimeType
	case "[]byte":
		return ByteSliceType
	case "string":
		return StringType
	case "[]string":
		return StringsType
	case "map[string]value":
		return MapValueType
	case "map[string]int":
		return MapIntType
	case "map[string]string":
		return MapStringType
	case "map[string]number":
		return MapNumberType
	case "map[string]bool":
		return MapBoolType
	case "map[string]time":
		return MapTimeType
	case "[]value":
		return SliceValueType
	case "struct":
		return StructType
	case "json":
		return JsonType
	default:
		return UnknownType
	}
}
894150
func NameOfReader(r interface{}) string {
	if nr, ok := r.(interface{ Name() string }); ok {
		return nr.Name()
	}
	return ""
}
101205
func ReaderToString(lines io.Reader) string {
	if lines == nil {
		return ""
	}
	b := bp.GetBuffer()
	defer bp.PutBuffer(b)
	b.ReadFrom(lines)
	return b.String()
}
1087761
func ChoiceIndexFromStr(choice string) (VoteChoice, error) {
	switch choice {
	case "abstain":
		return Abstain, nil
	case "yes":
		return Yes, nil
	case "no":
		return No, nil
	default:
		return VoteChoiceUnknown, fmt.Errorf(`Vote Choice "%s" is unknown`, choice)
	}
}
1090185
func FormatFromString(formatStr string) Format {
	formatStr = strings.ToLower(formatStr)
	if strings.Contains(formatStr, ".") {
		// Assume a filename
		formatStr = strings.TrimPrefix(filepath.Ext(formatStr), ".")

	}
	switch formatStr {
	case "yaml", "yml":
		return YAML
	case "json":
		return JSON
	case "toml":
		return TOML
	case "org":
		return ORG
	case "csv":
		return CSV
	}

	return ""

}
475825
func SelectOneOf(protos []string, rwc io.ReadWriteCloser) (string, error) {
	err := handshake(rwc)
	if err != nil {
		return "", err
	}

	for _, p := range protos {
		err := trySelect(p, rwc)
		switch err {
		case nil:
			return p, nil
		case ErrNotSupported:
		default:
			return "", err
		}
	}
	return "", ErrNotSupported
}
72481
func (b *SelectStmt) ReturnString() (string, error) {
	var v string
	err := b.LoadOne(&v)
	return v, err
}
69370
func ParseAndTransformSelector(selector string, fn TransformFunc) (Selector, error) {
	return parseSelector(selector, fn)
}
1224704
func (s *RawString) ReadFrom(r Reader, l int) error {
	var ba RawByteSlice
	if err := ba.ReadFrom(r, l); err != nil {
		return err
	}
	*s = RawString(ba)

	return nil
}
973629
func NewPremailerFromString(doc string, options *Options) (Premailer, error) {
	read := strings.NewReader(doc)
	d, err := goquery.NewDocumentFromReader(read)
	if err != nil {
		return nil, err
	}
	return NewPremailer(d, options), nil
}
381754
func LoadFromString(sql string) (*DotSql, error) {
	buf := bytes.NewBufferString(sql)
	return Load(buf)
}
1265889
func DataTypeFromString(s string) DataType {
	switch s {
	case "float":
		return Float
	case "integer":
		return Integer
	case "unsigned":
		return Unsigned
	case "string":
		return String
	case "boolean":
		return Boolean
	case "time":
		return Time
	case "duration":
		return Duration
	case "tag":
		return Tag
	case "field":
		return AnyField
	default:
		return Unknown
	}
}
1146831
func selectString(s, spec string) bool {
	if spec == "*" {
		return true
	}
	if !strings.Contains(spec, "*") {
		return s == spec
	}

	pos := 0
	match := true
	parts := strings.Split(spec, "*")
	for i, part := range parts {
		if len(part) == 0 {
			continue
		}
		next := strings.Index(s[pos:], part)
		switch {
		// next part not in string
		case next < pos:
			fallthrough
		// first part does not match start of string
		case i == 0 && pos != 0:
			fallthrough
		// last part does not exactly match remaining part of string
		case i == (len(parts)-1) && len(s) != (len(part)+next):
			match = false
			break
		default:
			pos = next
		}
	}
	return match
}
1033539
func (t *TablePropNextTables) ReadFrom(r io.Reader) (int64, error) {
	header, _, n, err := yieldTableProp(r, &t.Miss)
	if err != nil {
		return n, err
	}

	t.NextTables = make([]Table, header.Len-tablePropLen)
	padding := makePad(int(header.Len))

	nn, err := encoding.ReadFrom(r, &t.NextTables, padding)
	return n + nn, err
}