Documentation ¶
Index ¶
- Variables
- func AfterSaveFile(f field) error
- func BeforeSaveFile(f field) error
- func GetPhotoName(id string, filename string) string
- type Band
- func (b *Band) AfterSave(tx *pop.Connection) error
- func (b *Band) BeforeSave(tx *pop.Connection) error
- func (b *Band) GetID() string
- func (b *Band) GetPhotoFileName() string
- func (b *Band) GetPhotoStream() binding.File
- func (b *Band) SetPhotoName() error
- func (b *Band) ValidPhoto() bool
- func (p *Band) Validate(tx *pop.Connection) (*validate.Errors, error)
- type BandVenueEventRequest
- type BandVenueEventRequests
- type Bands
- type Booker
- func (b *Booker) AfterSave(tx *pop.Connection) error
- func (b *Booker) BeforeSave(tx *pop.Connection) error
- func (b *Booker) GetID() string
- func (b *Booker) GetPhotoFileName() string
- func (b *Booker) GetPhotoStream() binding.File
- func (b *Booker) SetPhotoName() error
- func (b *Booker) ValidPhoto() bool
- func (b *Booker) Validate(tx *pop.Connection) (*validate.Errors, error)
- type Bookers
- type EmailNotTaken
- type User
- func (u *User) Authorize(tx *pop.Connection) error
- func (u *User) AuthorizeDelete(ownerID uuid.UUID, c buffalo.Context) (bool, string, string)
- func (u *User) Create(tx *pop.Connection) (*validate.Errors, error)
- func (u User) String() string
- func (u *User) Validate(tx *pop.Connection) (*validate.Errors, error)
- func (u *User) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)
- func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)
- type UsernameNotTaken
- type Users
- type Venue
- func (v *Venue) AfterSave(tx *pop.Connection) error
- func (v *Venue) BeforeSave(tx *pop.Connection) error
- func (v *Venue) GetID() string
- func (v *Venue) GetPhotoFileName() string
- func (v *Venue) GetPhotoStream() binding.File
- func (v *Venue) SetPhotoName() error
- func (v *Venue) ValidPhoto() bool
- func (p *Venue) Validate(tx *pop.Connection) (*validate.Errors, error)
- type Venues
Constants ¶
This section is empty.
Variables ¶
var DB *pop.Connection
DB is a connection to your database to be used throughout your application.
Functions ¶
func AfterSaveFile ¶
func AfterSaveFile(f field) error
AfterSave is a callback that saves the file after the venue is saved to the database
func BeforeSaveFile ¶
func BeforeSaveFile(f field) error
BeforeSave is a callback that preprocess the struct before saving it to the database
func GetPhotoName ¶
GetPhotoName returns the path of the photo
Types ¶
type Band ¶
type Band struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Name string `json:"title" db:"name"` Description string `json:"content" db:"description"` Photo string `json:"photo" db:"photo"` LocationText nulls.String `json:"location_text" db:"location_text"` Country nulls.Int `json:"country" db:"country"` State nulls.Int `json:"state" db:"state"` City nulls.Int `json:"city" db:"city"` PhotoFile binding.File `json:"photo_file" db:"-" form:"photo_file"` OwnerID uuid.UUID `json:"owner_id" db:"owner_id"` }
func (*Band) AfterSave ¶
func (b *Band) AfterSave(tx *pop.Connection) error
AfterSave is a callback that saves the file after the venue is saved to the database
func (*Band) BeforeSave ¶
func (b *Band) BeforeSave(tx *pop.Connection) error
BeforeSave is a callback that preprocess the struct before saving it to the database
func (*Band) GetPhotoFileName ¶
GetPhotoFilename returns the filename of the uploaded photo
func (*Band) GetPhotoStream ¶
GetPhotoStream returns the file representation of the form uploaded file
func (*Band) SetPhotoName ¶
SetPhotoName sets the photo filename parameter in the Photo field of te database
func (*Band) ValidPhoto ¶
ValidPhoto returns true if there's an uploaded photo from the form
type BandVenueEventRequest ¶
type BandVenueEventRequest struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` BandID uuid.UUID `json:"band_id" db:"band_id"` VenueID uuid.UUID `json:"venue_id" db:"venue_id"` RequestDate time.Time `json:"request_date" db:"request_date"` OwnerID uuid.UUID `json:"owner_id" db:"owner_id"` Status int `json:"status" db:"status"` BandName string `json:"name" db:"name"` }
func (*BandVenueEventRequest) GetID ¶
func (b *BandVenueEventRequest) GetID() string
GetID returns a string representation of the ID
func (*BandVenueEventRequest) GetRequests ¶
func (b *BandVenueEventRequest) GetRequests(tx *pop.Connection) (BandVenueEventRequests, error)
type BandVenueEventRequests ¶
type BandVenueEventRequests []BandVenueEventRequest
type Booker ¶
type Booker struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Name string `json:"title" db:"name"` Description string `json:"content" db:"description"` Photo string `json:"photo" db:"photo"` LocationText nulls.String `json:"location_text" db:"location_text"` Country nulls.Int `json:"country" db:"country"` State nulls.Int `json:"state" db:"state"` City nulls.Int `json:"city" db:"city"` PhotoFile binding.File `json:"photo_file" db:"-" form:"photo_file"` OwnerID uuid.UUID `json:"owner_id" db:"owner_id"` }
func (*Booker) AfterSave ¶
func (b *Booker) AfterSave(tx *pop.Connection) error
AfterSave is a callback that saves the file after the venue is saved to the database
func (*Booker) BeforeSave ¶
func (b *Booker) BeforeSave(tx *pop.Connection) error
BeforeSave is a callback that preprocess the struct before saving it to the database
func (*Booker) GetPhotoFileName ¶
GetPhotoFilename returns the filename of the uploaded photo
func (*Booker) GetPhotoStream ¶
GetPhotoStream returns the binding.File field
func (*Booker) SetPhotoName ¶
SetPhotoName sets the photo filename parameter in the Photo field of te database
func (*Booker) ValidPhoto ¶
ValidPhoto returns true if there's an uploaded photo from the form
type EmailNotTaken ¶
Check for emails
func (*EmailNotTaken) IsValid ¶
func (v *EmailNotTaken) IsValid(errors *validate.Errors)
Check if email is already taken TODO create a more generic interface for this validator
type User ¶
type User struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Firstname nulls.String `json:"firstname" db:"firstname"` Username string `json:"username" db:"username" form:"username"` Middlename nulls.String `json:"middlename" db:"middlename"` Lastname nulls.String `json:"lastname" db:"lastname"` Mlastname nulls.String `json:"mlastname" db:"mlastname"` Email string `json:"email" db:"email"` Phone nulls.String `json:"phone" db:"phone"` Password string `json:"-" db:"-"` PasswordHash string `json:"-" db:"password_hash"` PasswordConfirm string `json:"-" db:"-"` Admin bool `json:"admin" db:"admin"` }
func (*User) Authorize ¶
func (u *User) Authorize(tx *pop.Connection) error
Check user password and ACLs
func (*User) AuthorizeDelete ¶
AuthorizeDelete checks if the user has deletion privileges on the item
func (*User) Validate ¶
Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.
func (*User) ValidateCreate ¶
ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.
func (*User) ValidateUpdate ¶
ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.
type UsernameNotTaken ¶
func (*UsernameNotTaken) IsValid ¶
func (v *UsernameNotTaken) IsValid(errors *validate.Errors)
Check if username is already taken
type Venue ¶
type Venue struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Name string `json:"name" db:"name"` Description string `json:"description" db:"description"` Photo string `json:"photo" db:"photo"` LocationText nulls.String `json:"location_text" db:"location_text"` Country nulls.Int `json:"country" db:"country"` Address nulls.String `json:"address" db:"address"` Zip nulls.String `json:"zip" db:"zip"` Phone nulls.String `json:"phone" db:"phone"` State nulls.Int `json:"state" db:"state"` City nulls.Int `json:"city" db:"city"` PhotoFile binding.File `json:"photo_file" db:"-" form:"photo_file"` OwnerID uuid.UUID `json:"owner_id" db:"owner_id"` }
func (*Venue) AfterSave ¶
func (v *Venue) AfterSave(tx *pop.Connection) error
AfterSave is a callback that saves the file after the venue is saved to the database
func (*Venue) BeforeSave ¶
func (v *Venue) BeforeSave(tx *pop.Connection) error
BeforeSave is a callback that sets fields to be added to the database
func (*Venue) GetPhotoFileName ¶
GetPhotoFilename returns the filename of the uploaded photo
func (*Venue) GetPhotoStream ¶
func (*Venue) SetPhotoName ¶
SetPhotoName sets the photo filename parameter in the Photo field of te database
func (*Venue) ValidPhoto ¶
ValidPhoto returns true if there's an uploaded photo from the form