dao

package
v0.0.0-...-e939e64 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao interface {
	Get() (*Product, error)
	Create(*Product) error
	Update()
	Delete()
}

Dao is an interface

func NewDao

func NewDao(db *gorm.DB) Dao

NewDao is a function that defines a new dao instance

type Product

type Product struct {
	// ID is Product's primary key.
	ID uint64 `gorm:"primary_key"`
	// Name is Product's name.
	Name string `gorm:"size:150" sql:"not null"`
	// Price is Product's pricing.
	Price float64 `sql:"not null"`
	// CreatedAt for gorm to insert create time.
	CreatedAt time.Time
	// UpdatedAt for gorm to insert update time.
	UpdatedAt time.Time
}

Product is a struct

Jump to

Keyboard shortcuts

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