예제 #1
0
파일: que.go 프로젝트: justintung/flynn
func (b bytea) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	if len(b) == 0 {
		w.WriteInt32(-1)
		return nil
	}
	w.WriteInt32(int32(len(b)))
	w.WriteBytes(b)
	return nil
}
예제 #2
0
func (p NullPoint) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	if !p.Valid {
		w.WriteInt32(-1)
		return nil
	}

	s := fmt.Sprintf("point(%v,%v)", p.X, p.Y)
	w.WriteInt32(int32(len(s)))
	w.WriteBytes([]byte(s))

	return nil
}
예제 #3
0
func (n *coreEncoder) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	w.WriteInt32(int32(2))
	w.WriteBytes([]byte("42"))
	return nil
}