Documentation ¶
Index ¶
- Variables
- func NormalizeEmail(email string) (string, error)
- type Email
- type ImmutableFK
- func (fk ImmutableFK) Exists(conn sol.Conn) bool
- func (fk ImmutableFK) MarshalJSON() ([]byte, error)
- func (fk ImmutableFK) Modify(table sol.Tabular) error
- func (fk *ImmutableFK) Scan(value interface{}) error
- func (fk *ImmutableFK) SetTable(name string, table *sol.TableElem)
- func (fk *ImmutableFK) UnmarshalJSON(b []byte) error
- func (fk ImmutableFK) Value() (driver.Value, error)
- type JSON
- type NullableFK
- func (fk NullableFK) Exists(conn sol.Conn) bool
- func (fk NullableFK) MarshalJSON() ([]byte, error)
- func (fk NullableFK) Modify(table sol.Tabular) error
- func (fk *NullableFK) Scan(value interface{}) error
- func (fk *NullableFK) UnmarshalJSON(b []byte) error
- func (fk NullableFK) Value() (driver.Value, error)
- type Serial
- type Timestamp
- type URL
- type UUID
- func (uuid UUID) Equals(other UUID) bool
- func (uuid UUID) Exists() bool
- func (uuid UUID) Keys() []interface{}
- func (uuid UUID) MarshalJSON() ([]byte, error)
- func (uuid UUID) Modify(table sol.Tabular) error
- func (uuid *UUID) Scan(value interface{}) error
- func (uuid UUID) String() string
- func (u *UUID) UnmarshalJSON(data []byte) error
- func (uuid UUID) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var UUIDv4 = postgres.UUID().NotNull()
Functions ¶
func NormalizeEmail ¶
NormalizeEmail will check that the email has at least one @ - it will then lowercase both the local name and domain
Types ¶
type Email ¶
type Email string
Email is an email type
func (*Email) Normalize ¶
Normalize will perform an in-place normalization of the email, only returning an email if normalization fails
func (*Email) UnmarshalJSON ¶
UnmarshalJSON for emails trims spaces
type ImmutableFK ¶
ImmutableFK is a foreign key. It embeds an ID and adds a column name (such as remote_id) and foreign key table (such as Remotes)
func (ImmutableFK) Exists ¶
func (fk ImmutableFK) Exists(conn sol.Conn) bool
Exists returns true if the foreign key table has an entry with the given ID
func (ImmutableFK) MarshalJSON ¶
func (fk ImmutableFK) MarshalJSON() ([]byte, error)
MarshalJSON returns the inner ID
func (ImmutableFK) Modify ¶
func (fk ImmutableFK) Modify(table sol.Tabular) error
Modify implements the sol.Modifier interface
func (*ImmutableFK) Scan ¶
func (fk *ImmutableFK) Scan(value interface{}) error
Scan implements the database/sql.Scanner interface
func (*ImmutableFK) SetTable ¶
func (fk *ImmutableFK) SetTable(name string, table *sol.TableElem)
SetTable sets the column name and table of the foreign key
func (*ImmutableFK) UnmarshalJSON ¶
func (fk *ImmutableFK) UnmarshalJSON(b []byte) error
UnmarshalJSON allows an ID to be set once, but only once TODO Why not use UnmarshalText? https://github.com/golang/go/issues/9650
type JSON ¶
type JSON map[string]interface{}
type NullableFK ¶
type NullableFK struct { ImmutableFK Valid bool }
NullableFK is a foreign key that can be NULL. It embeds an ImmutableFK
func (NullableFK) Exists ¶
func (fk NullableFK) Exists(conn sol.Conn) bool
Exists returns true if the foreign key table has an entry with the given ID or the FK is NULL.
func (NullableFK) MarshalJSON ¶
func (fk NullableFK) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON output of the FK
func (NullableFK) Modify ¶
func (fk NullableFK) Modify(table sol.Tabular) error
Modify implements the sol.Modifier interface
func (*NullableFK) Scan ¶
func (fk *NullableFK) Scan(value interface{}) error
Scan converts the raw SQL value into a NullableFK
func (*NullableFK) UnmarshalJSON ¶
func (fk *NullableFK) UnmarshalJSON(b []byte) error
type Serial ¶
type Serial struct {
ID uint64 `db:"id,omitempty" json:"id" xml:"ID"`
}
Serial is an embeddable type that can be used as a primary key for a table
type Timestamp ¶
type Timestamp struct { CreatedAt time.Time `db:"created_at,omitempty" json:"created_at"` UpdatedAt pq.NullTime `db:"updated_at" json:"updated_at,omitempty"` }
Timestamp records create and update timestamps.
func TimestampColumns ¶
func TimestampColumns() Timestamp
TimestampColumns returns a Modifier suitable for inclusion in a Table
func (Timestamp) LastActivity ¶
LastActivity returns the time of the lastest activity on the timestamp - either when it was updated or created. Updated is assumed to have always been at or after creation.
func (*Timestamp) SetUpdatedAt ¶
SetUpdatedAt sets the updated_at field
func (Timestamp) WasUpdated ¶
Updated returns true if the timestamp has been updated
type URL ¶
type URL string
URL is a URL field TODO Just boilerplate for now
type UUID ¶
type UUID [16]byte
func NewUUID ¶
func NewUUID() (u UUID)
http://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29
func (UUID) String ¶
String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx , or "" if uuid is invalid.