models

package
v0.0.0-...-1a3755f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	MessageRequest

	ID string `gorm:"type:uuid; primary_key" json:"id"`

	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

func NewMessage

func NewMessage(text string) *Message

NewMessage create new message

func Seed

func Seed(db *gorm.DB) *Message

Seed generate a testentry

func (*Message) BeforeCreate

func (m *Message) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will create a uuid right before creating

type MessageRequest

type MessageRequest struct {
	Text string `json:"message" validate:"required,min=3,max=160"`
}

func (*MessageRequest) Validate

func (r *MessageRequest) Validate() *map[string]string

Validate request by annotations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL