mirror of
https://github.com/acaloiaro/newsbox
synced 2026-07-21 18:29:15 +00:00
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
|
|
package models
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/gobuffalo/pop/v6"
|
||
|
|
"github.com/gobuffalo/validate/v3"
|
||
|
|
"github.com/gofrs/uuid"
|
||
|
|
)
|
||
|
|
|
||
|
|
// MessageDelivery is used by pop to map your message_deliveries database table to your go code.
|
||
|
|
type MessageDelivery struct {
|
||
|
|
ID uuid.UUID `json:"id" db:"id"`
|
||
|
|
MessageID uuid.UUID `json:"message_id" db:"message_id"`
|
||
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// String is not required by pop and may be deleted
|
||
|
|
func (m MessageDelivery) String() string {
|
||
|
|
jm, _ := json.Marshal(m)
|
||
|
|
return string(jm)
|
||
|
|
}
|
||
|
|
|
||
|
|
// MessageDeliveries is not required by pop and may be deleted
|
||
|
|
type MessageDeliveries []MessageDelivery
|
||
|
|
|
||
|
|
// String is not required by pop and may be deleted
|
||
|
|
func (m MessageDeliveries) String() string {
|
||
|
|
jm, _ := json.Marshal(m)
|
||
|
|
return string(jm)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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 (m *MessageDelivery) Validate(tx *pop.Connection) (*validate.Errors, error) {
|
||
|
|
return validate.NewErrors(), nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ValidateCreate gets run every time you call "pop.ValidateAndCreate" method.
|
||
|
|
// This method is not required and may be deleted.
|
||
|
|
func (m *MessageDelivery) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {
|
||
|
|
return validate.NewErrors(), nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method.
|
||
|
|
// This method is not required and may be deleted.
|
||
|
|
func (m *MessageDelivery) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {
|
||
|
|
return validate.NewErrors(), nil
|
||
|
|
}
|