Skip to content

Commit 8cc88e1

Browse files
authored
add docs for UUID4 default (#1308)
1 parent 58d8754 commit 8cc88e1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/src/piccolo/api_reference/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ Date
106106
.. autoclass:: DateOffset
107107
:members:
108108

109+
110+
UUID
111+
~~~~
112+
113+
.. autoclass:: UUID4
114+
:members:
115+
109116
-------------------------------------------------------------------------------
110117

111118
Testing

piccolo/columns/defaults/uuid.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88

99
class UUID4(Default):
10+
"""
11+
This makes the default value for a
12+
:class:`UUID <piccolo.columns.column_types.UUID>` column a randomly
13+
generated UUID v4 value. The advantage over using :func:`uuid.uuid4` from
14+
the standard library, is the default is set on the column definition in the
15+
database too.
16+
"""
17+
1018
@property
1119
def postgres(self):
1220
return "uuid_generate_v4()"

0 commit comments

Comments
 (0)