// Encoding is a query option that allows the caller to set a message encoding
// for the query messages.
967052
func Encoding(encoding wire.MessageEncoding) QueryOption {
	return func(qo *queryOptions) {
		qo.encoding = encoding
	}
}
984482
func (r *RepositoryContent) GetEncoding() string {
	if r == nil || r.Encoding == nil {
		return ""
	}
	return *r.Encoding
}
852125
func Encode(data interface{}) string {
	switch v := data.(type) {
	case string:
		return EncodeString(v)
	case int:
		return EncodeInt(v)
	case []interface{}:
		return EncodeList(v)
	case map[string]interface{}:
		return EncodeDict(v)
	default:
		panic("invalid type when encode")
	}
}
1117934
func (res *Response) Encode(w io.Writer) error {
	var buf [16]byte
	binary.BigEndian.PutUint64(buf[0:8], uint64(res.Physical))
	binary.BigEndian.PutUint64(buf[8:16], uint64(res.Logical))
	_, err := w.Write(buf[0:16])
	return errors.Trace(err)
}
764093
func (s ISO88595) Encode() []byte {
	e := charmap.ISO8859_5.NewEncoder()
	es, _, err := transform.Bytes(e, s)
	if err != nil {
		return s
	}
	return es
}
2164
func (p Parameters) Encode() string {
	var buf bytes.Buffer
	keys := make([]string, 0, len(p))
	for k := range p {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for _, k := range keys {
		if buf.Len() > 0 {
			buf.WriteByte('&')
		}
		buf.WriteString(url.QueryEscape(k) + "=")
		buf.WriteString(url.QueryEscape(p[k]))
	}
	return buf.String()
}
928499
func (enc *Encoder) Encode(m *Message) (err error) {

	_, err = enc.Write(m.Bytes())

	return
}
355860
func Decode(charset int, latin []byte) (utf_8 []byte, err error) {
	return converters[charset].Decode(latin)
}
437289
func (mr *MockPacketEncoderMockRecorder) Encode(typ, data interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Encode", reflect.TypeOf((*MockPacketEncoder)(nil).Encode), typ, data)
}
1106427
func (enc *Encoding) Encode(src []byte) ([]byte, error) {
	if len(src) == 0 {
		return []byte{}, nil
	}
	n, ok := new(big.Int).SetString(string(src), 10)
	if !ok {
		return nil, fmt.Errorf("expecting a number but got %q", src)
	}
	bytes := make([]byte, 0, len(src))
	for _, c := range src {
		if c == '0' {
			bytes = append(bytes, enc.alphabet[0])
		} else {
			break
		}
	}
	zerocnt := len(bytes)
	mod := new(big.Int)
	zero := big.NewInt(0)
	for {
		switch n.Cmp(zero) {
		case 1:
			n.DivMod(n, radix, mod)
			bytes = append(bytes, enc.alphabet[mod.Int64()])
		case 0:
			reverse(bytes[zerocnt:])
			return bytes, nil
		default:
			return nil, fmt.Errorf("expecting a non-negative number in base58 encoding but got %s", n)
		}
	}
}
135585
func (enc *EncodingDefinition) Context() string {
	return fmt.Sprintf("encoding for %s", strings.Join(enc.MIMETypes, ", "))
}
1293153
func Query(query string) (*Message, error) {
	ddgUrl := EncodeUrl(query)

	body, err := Do(ddgUrl)
	if err != nil {
		return nil, err
	}

	message := &Message{}
	if err = message.Decode(body); err != nil {
		return nil, err
	}

	return message, nil
}
159068
func FormatFromEncoding(v string) (Format, error) {
	switch v {
	case "", mtPRPCEncodingBinary:
		return FormatBinary, nil
	case mtPRPCEncodingJSONPB:
		return FormatJSONPB, nil
	case mtPRPCEncodingText:
		return FormatText, nil
	default:
		return 0, fmt.Errorf(`invalid encoding parameter: %q. Valid values: `+
			`"`+mtPRPCEncodingBinary+`", `+
			`"`+mtPRPCEncodingJSONPB+`", `+
			`"`+mtPRPCEncodingText+`"`, v)
	}
}
198964
func (req *request) Encode() (data []byte) {
	l := len(req.Data)        // length of data
	tl := l + minPacketLength // add 12 bytes head
	data = getBuffer(tl)
	copy(data[:4], reqStr)
	binary.BigEndian.PutUint32(data[4:8], req.DataType)
	binary.BigEndian.PutUint32(data[8:12], uint32(l))
	copy(data[minPacketLength:], req.Data)
	return
}
273912
func encode(msgType messageType, in interface{}) (*bytes.Buffer, error) {
	buf := bytes.NewBuffer(nil)
	buf.WriteByte(uint8(msgType))
	hd := codec.MsgpackHandle{}
	enc := codec.NewEncoder(buf, &hd)
	err := enc.Encode(in)
	return buf, err
}
872069
func (s *Script) Lang(lang string) *Script {
	s.lang = lang
	return s
}
281201
func (r *RepositoryLicense) GetEncoding() string {
	if r == nil || r.Encoding == nil {
		return ""
	}
	return *r.Encoding
}