database

package
v0.0.0-...-6e65144 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput = errors.New("invalid input")
)
View Source
var (
	ErrNotFound = "sql: no rows in result set"
)

Functions

This section is empty.

Types

type Category

type Category struct {
	ID   int    `db:"id"`
	Name string `db:"name"`
}

type CategoryList

type CategoryList []Category

type Circle

type Circle struct {
	ID            int     `db:"id"`
	Name          string  `db:"name"`
	About         string  `db:"about"`
	CatchCopy     string  `db:"catch_copy"`
	Cost          *string `db:"cost"`
	Location      *string `db:"location"`
	WorkTime      *string `db:"work_time"`
	MembersNumber *string `db:"members_number"`
	Description   string  `db:"description"`
	CategoryID    int     `db:"circle_category_id"`
	Email         string  `db:"email"`
	Twitter       string  `db:"twitter"`
	URL           string  `db:"url"`
	EyeCatch      string  `db:"eyecatch"`
	TypeID        *int    `db:"type_id"`
	TypeName      *string `db:"type_name"`
	UpdatedAt     string  `db:"updated_at"`
}

type CircleImage

type CircleImage struct {
	URL string `db:"url"`
}

type CircleList

type CircleList []Circle

type CircleType

type CircleType struct {
	ID   int    `db:"id"`
	Name string `db:"name"`
}

type DBRepository

type DBRepository interface {
	// api
	ListCategory(input ListCategoryInput) ([]*model.Category, error)
	GetCircle(input GetCircleInput) (*model.GetCircle, error)
	ListCircle(input ListCircleInput) ([]*model.Circle, error)

	// admin
	PostCircle(input PostCircleInput) error
}

type GetCircle

type GetCircle struct {
	ID            int     `db:"id"`
	Name          string  `db:"name"`
	About         string  `db:"about"`
	CatchCopy     string  `db:"catch_copy"`
	Cost          *string `db:"cost"`
	Location      *string `db:"location"`
	WorkTime      *string `db:"work_time"`
	MembersNumber *string `db:"members_number"`
	Description   string  `db:"description"`
	CategoryID    int     `db:"circle_category_id"`
	Email         string  `db:"email"`
	Twitter       string  `db:"twitter"`
	URL           string  `db:"url"`
	EyeCatch      string  `db:"eyecatch"`
	UpdatedAt     string  `db:"updated_at"`
}

type GetCircleInput

type GetCircleInput struct {
	ID int
}

type InputCircleImage

type InputCircleImage struct {
	URL string
}

type InputCircleType

type InputCircleType struct {
	ID int
}

type ListCategoryInput

type ListCategoryInput struct{}

api

type ListCircleInput

type ListCircleInput struct {
	CategoryID []int
}

type PostCircle

type PostCircle struct {
	ID          int    `db:"id,primarykey,autoincrement"`
	Name        string `db:"name"`
	About       string `db:"about"`
	CatchCopy   string `db:"catch_copy"`
	Description string `db:"description"`
	CategoryID  int    `db:"circle_category_id"`
	Email       string `db:"email"`
	Twitter     string `db:"twitter"`
	URL         string `db:"url"`
	EyeCatch    string `db:"eyecatch"`
}

type PostCircleImages

type PostCircleImages struct {
	ID       int    `db:"id,primarykey,autoincrement"`
	URL      string `db:"url"`
	CircleID int    `db:"circle_id"`
}

type PostCircleInput

type PostCircleInput struct {
	Name        string
	About       string
	CatchCopy   string
	Description string
	EyeCatch    string
	Email       string
	Twitter     string
	URL         string
	Images      []InputCircleImage
	Types       []InputCircleType
	CategoryID  int
}

admin

type PostCirclesCircleTypes

type PostCirclesCircleTypes struct {
	ID           int `db:"id,primarykey,autoincrement"`
	CircleID     int `db:"circle_id"`
	CircleTypeID int `db:"circle_type_id"`
}

type ShinkanDatabase

type ShinkanDatabase struct {
	Map *gorp.DbMap
}

func NewDatabase

func NewDatabase(user, password, host, port, database string) *ShinkanDatabase

func (*ShinkanDatabase) GetCircle

func (db *ShinkanDatabase) GetCircle(input GetCircleInput) (*model.GetCircle, error)

func (*ShinkanDatabase) ListCategory

func (db *ShinkanDatabase) ListCategory(input ListCategoryInput) ([]*model.Category, error)

func (*ShinkanDatabase) ListCircle

func (db *ShinkanDatabase) ListCircle(input ListCircleInput) ([]*model.Circle, error)

func (*ShinkanDatabase) PostCircle

func (db *ShinkanDatabase) PostCircle(input PostCircleInput) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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