Esempio n. 1
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
}
Esempio n. 2
0
func readSerialConsistency(r io.Reader, fs queryFlagSet, c *proto.Consistency) error {
	if !fs.Contains(qrySerialConsistency) {
		return nil
	}
	return proto.ReadConsistency(r, c)
}