models

package
v0.0.0-...-7df1e21 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Migrate the database

Types

type Event

type Event struct {
	ID string `gorm:"type:uuid; primary_key;" json:"id" validate:"-"`

	Title       string `json:"title" validate:"required,min=5,max=200,alphanum"`
	Description string `json:"description" validate:"omitempty,max=200,alphanum"`

	ImageURL string `json:"image_url" validate:"omitempty,url"`

	EventStart    time.Time `json:"event_start" validate:"required"`
	WithStartTime bool      `json:"with_starttime"  validate:"-"`

	Platform string `json:"platform" validate:"omitempty,max=40,alphanum"`
	URL      string `json:"url" validate:"omitempty,url"`

	Category string `json:"category" validate:"omitempty,max=40,alphanum"`

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

Event Model

func NewEvent

func NewEvent(title string) *Event

NewEvent return a event object with title

func (*Event) BeforeCreate

func (e *Event) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

Jump to

Keyboard shortcuts

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