newsbox/models/message_delivery.go

52 lines
1.7 KiB
Go
Raw Permalink Normal View History

2023-02-15 16:56:06 +00:00
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
}