Esempio n. 1
0
func readFrame(in io.Reader, f *frame) error {
	if err := proto.ReadBinary(in, &f.header); err != nil {
		return err
	}

	f.body = make([]byte, f.header.Length)
	if _, err := io.ReadFull(in, f.body); err != nil {
		return err
	}

	return nil
}
Esempio n. 2
0
func readQuery(r io.Reader, q *Query) error {
	var err error
	if q.Statement, err = proto.ReadLongString(r); err != nil {
		return err
	}

	if err := proto.ReadConsistency(r, &q.Consistency); err != nil {
		return err
	}

	if err := proto.ReadBinary(r, &q.flagSet); err != nil {
		return err
	}

	if q.values, q.valueNames, err = readValues(r, q.flagSet); err != nil {
		return err
	}

	if err := readPageSize(r, q.flagSet, &q.pageSize); err != nil {
		return err
	}

	if q.pagingState, err = readPagingState(r, q.flagSet); err != nil {
		return err
	}

	if err := readSerialConsistency(r, q.flagSet, &q.serialConsistency); err != nil {
		return err
	}

	if q.defaultTimestamp, err = readDefaultTimestamp(r, q.flagSet); err != nil {
		return err
	}

	return nil
}