Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { TableName `db:"user_addresses"` UserId string `db:"primary_key,type=uuid"` MainAddress bool `db:"primary_key,type=bit"` Street string City string ZipCode int // Relational data User User `db:"one=users,by=UserId"` }
Address with composite primary key and a custom table name
type Car ¶
type Car struct { UserId string `db:"primary_key,type=uuid"` Model string `db:"primary_key"` Color Colors `db:"enum"` // Relational data User User `db:"one=users,by=UserId"` }
Car with composite primary key
type User ¶
type User struct { Id string `db:"primary_key,type=uuid"` FirstName string LastName string Gender string Age int // Relational data Friends []User `db:"manyToMany=users,by=Id"` Address Address `db:"one=user_addresses,by=Id,having=mainAddress;true"` Cars []Car `db:"many=userCars,by=Id"` }
User with related objects: 1:1, 1:n, n:n relations
Click to show internal directories.
Click to hide internal directories.