I have the following class:
class ExampleValue:
NULL = 'null'
BOOLEAN = 'true'
INTEGER = '4'
FLOAT = '?'
DECIMAL = '?'
STRING = '"HELLO"'
BYTES = 'b"xyz"'
DATE = 'DATE "2014-01-01"'
TIME = 'TIME "01:02:03"'
DATETIME = 'DATETIME "2014-01-01T01:02:03"'
INTERVAL = 'INTERVAL 4 HOUR'
GEOGRAPHY = 'POINT(1 1)'
JSON = 'JSON "[1,2,3]"'
STRUCT = '{"x": 2}'
ARRAY = '[1,2,3]'
And I would like to iterate from the first one to the last. Is there a way to do this while keeping the ordering (or should I use a different 'type' than a class?). How I am currently doing it is:
>>> for val in ExampleValue.__dict__: # or dir(ExampleValue)
... if not val.startswith('_'):
... print (val)
...
INTERVAL
STRING
DECIMAL
FLOAT
BYTES
DATETIME
STRUCT
JSON
BOOLEAN
TIME
DATE
INTEGER
ARRAY
NULL
GEOGRAPHY