Demo¶
This is used to demonstrate various features, and also for testing.
Autodoc¶
- class piccolo_theme.snippets.Column(null: bool = False, primary_key: bool = False, unique: bool = False, index: bool = False, required: bool = False, help_text: Optional[str] = None, choices: Optional[Type[enum.Enum]] = None, db_column_name: Optional[str] = None, secret: bool = False, **kwargs)¶
All other columns inherit from
Column
. Don’t use it directly.The following arguments apply to all column types:
- Parameters
null – Whether the column is nullable.
primary_key – If set, the column is used as a primary key.
default – The column value to use if not specified by the user.
unique – If set, a unique contraint will be added to the column.
index – Whether an index is created for the column, which can improve the speed of selects, but can slow down inserts.
index_method – If index is set to
True
, this specifies what type of index is created.required – This isn’t used by the database - it’s to indicate to other tools that the user must provide this value. Example uses are in serialisers for API endpoints, and form fields.
help_text – This provides some context about what the column is being used for. For example, for a
Decimal
column calledvalue
, it could say'The units are millions of dollars'
. The database doesn’t use this value, but tools such as Piccolo Admin use it to show a tooltip in the GUI.choices – An optional Enum - when specified, other tools such as Piccolo Admin will render the available options in the GUI.
db_column_name –
If specified, you can override the name used for the column in the database. The main reason for this is when using a legacy database, with a problematic column name (for example
'class'
, which is a reserved Python keyword). Here’s an example:class MyTable(Table): class_ = Varchar(db_column_name="class") >>> await MyTable.select(MyTable.class_) [{'id': 1, 'class': 'test'}]
This is an advanced feature which you should only need in niche situations.
secret –
If
secret=True
is specified, it allows a user to automatically omit any fields when doing a select query, to help prevent inadvertent leakage of sensitive data.class Band(Table): name = Varchar() net_worth = Integer(secret=True) >>> await Band.select(exclude_secrets=True) [{'name': 'Pythonistas'}]
Breathe¶
-
class CppClass¶
CppClass class.
Details about CppClass.
Public Functions
-
const char *member_function(char, int)¶
A member function.
- Parameters
c – a character.
n – an integer.
- Throws
std::out_of_range – parameter is out of range.
- Returns
a character pointer.
-
const char *member_function(char, int)¶
-
void cpp_function(int *a, int *b, int *c)¶
Doing important things with parameter directions.
- Parameters
a – [out] output
b – [in] input
c – [inout] input but gets rewritten
-
void c_function(int *a, int *b, int *c)¶
Doing important things with parameter directions.
- Parameters
a – [out] output
b – [in] input
c – [inout] input but gets rewritten
Tables¶
Table 1¶
Name |
Drives |
---|---|
Alice |
True |
Bob |
True |
Curtis |
False |
Table 2¶
Header 1 |
Header 2 |
Header 3 |
---|---|---|
body row 1 |
column 2 |
column 3 |
body row 2 |
Cells may span columns. And several paragraphs. |
|
body row 3 |
Cells may span rows. |
|
body row 4 |
Data definitions¶
- Python
A great programming language.
- Sphinx
A powerful documentation tool.
Lists¶
Unordered List¶
Python
Rust
Javascript
Ordered List¶
Python
Rust
Javascript
Admonitions¶
Warning
This is a warning!
Error
This is an error!
Hint
This is a hint!
Note
This is a note!
A custom admonition
This is my custom admonition!