Mercurial > core / lisp/lib/dat/parquet/proto.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
ec1d4d544c36
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; proto.lisp --- Parquet Data Protocol 6 (in-package :dat/parquet) 8 (defgeneric parquet-read (value &optional stream)) 9 (defgeneric parquet-write (value &optional stream)) 11 (defmethod parquet-write ((value (eql t)) &optional stream) 12 "Encode a parquet boolean true value." 13 (declare (ignore value)) 14 (write-byte 1 stream)) 16 (defmethod parquet-write ((value (eql nil)) &optional stream) 17 "Encode a parquet boolean false value." 18 (declare (ignore value)) 19 (write-byte 0 stream)) 21 (defmethod parquet-write ((value string) &optional stream)) 24 (defun parquet-encode (value &optional stream) 25 "Encode a Lisp value and write it to a parquet stream." 26 (parquet-write value stream)) 28 (defun parquet-decode (string &key (start 0) end) 29 "Convert a PARQUET string into a Lisp object." 30 (with-input-from-string (stream string :start start :end end) 31 (values (parquet-read stream) 32 (file-position stream))))