models

package
v0.0.0-...-5e46497 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogPost

type BlogPost struct {
	ID          string    `gorm:primary_key" json:"id,omitempty"`
	Title       string    `gorm:"varchar(255);not null" json:"title,omitempty"`
	Description string    `gorm:"type:text;not null" json:"description,omitempty"`
	Body        string    `gorm:"type:text;not null" json:"body,omitempty"`
	CreatedAt   time.Time `gorm:"not null" json:"createdAt,omitempty"`
	UpdatedAt   time.Time `gorm:"not null" json:"updatedAt,omitempty"`
}

func (*BlogPost) BeforeCreate

func (blogPost *BlogPost) BeforeCreate(tx *gorm.DB) (err error)

type CreateBlogPostSchema

type CreateBlogPostSchema struct {
	Title       string `json:"title" validate:"required"`
	Description string `json:"description" validate:"required"`
	Body        string `json:"body" validate:"required"`
}

swagger:parameters createBlogPostSchema

type ErrorResponse

type ErrorResponse struct {
	Field string `json:"field"`
	Tag   string `json:"tag"`
	Value string `json:"value,omitempty"`
}

func ValidateStruct

func ValidateStruct[T any](payload T) []*ErrorResponse

type UpdateBlogPostSchema

type UpdateBlogPostSchema struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Body        string `json:"body,omitempty"`
}

Jump to

Keyboard shortcuts

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