Modules
- For supporting additional types with the Pg backend (or other future backends).
- For working with migrations. If using the butane CLI tool, it is not necessary to use these types directly.
- Prelude module to improve ergonomics.
- Types to support database queries. Most users will use the
query!
,filter!
, andfind!
macros instead of using this module directly.
Macros
- Type-safe way to refer to a column name. Use as
colname!(MODEL_TYPE, FIELD_NAME)
. E.g. For a model typeFoo
with a fieldbar
,colname!(Foo, bar) would return
“bar”, but
colname!(Foo, bat)would be a compiler error (assuming
Foo` does not have such a field. - Finds a specific database object.
- Constructs a filtered database query.
Structs
- Used to implement a relationship between models.
- Used to implement a many-to-many relationship between models.
- Used internally by butane to track state about the object.
Enums
- Butane errors.
- Enumeration of the types a database value may take.
- A database value.
Traits
- Trait for referencing the primary key for a given model. Used to implement ForeignKey equality tests.
- An object in the database.
- A type which may be the result of a database query.
- Type suitable for being a database column.
- Used to convert a
SqlVal
orSqlValRef
into another type. - Used to convert another type to a
SqlVal
orSqlValRef
.
Type Definitions
Attribute Macros
- Attribute macro which marks a type as being available to butane for use in models.
- Attribute macro which generates an implementation of
DataResult
. Continuing with our blog post example from model, we could create aDataResult
with only some of the fields fromPost
(to avoid fetching all of them in a query). - Attribute macro which marks a struct as being a data model and generates an implementation of
DataObject
. This macro will also write information to disk at compile time necessary to generate migrations