database

package
v0.0.0-...-0964d17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Plants = entity.Plants{
	entity.Plant{
		ID:          1,
		Name:        "じゃがいも",
		NickName:    "ジャガーくん",
		Price:       1200,
		Period:      90,
		Difficulty:  1,
		Description: "僕はおいしさ満点のジャガイモだいも!!!育てばホクホクフィーバーできるいもよ!!!!",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
	entity.Plant{
		ID:          2,
		Name:        "いちご",
		NickName:    "ベリーちゃん",
		Price:       1200,
		Period:      210,
		Difficulty:  3,
		Description: "ハァイ、私はベリーちゃん。甘いけど、私を育てるのは甘くないわよ。試してみる?",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
	entity.Plant{
		ID:          3,
		Name:        "なす",
		NickName:    "なっくん",
		Price:       1200,
		Period:      120,
		Difficulty:  4,
		Description: "やぁ!!!!!!!ナスだよ!!!!!田楽、焼き浸し、なんでも美味しいよ!!!!!僕を選んでおくれ!!!!!",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
	entity.Plant{
		ID:          4,
		Name:        "たまねぎ",
		NickName:    "たまちゃん",
		Price:       1200,
		Period:      80,
		Difficulty:  3,
		Description: "こんにちは。体によくて、サラダでもカレーでも何にでも使える玉ねぎ、育てたことある?",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
	entity.Plant{
		ID:          5,
		Name:        "きゅうり",
		NickName:    "キューちゃん",
		Price:       1200,
		Period:      90,
		Difficulty:  3,
		Description: "きゅきゅ!!僕は漬物にしてよし、サラダにしてよしのジューシーきゅうりだキュ!試してみるきゅ?",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
	entity.Plant{
		ID:          6,
		Name:        "にんじん",
		NickName:    "ジンさん",
		Price:       1200,
		Period:      120,
		Difficulty:  3,
		Description: "人参、俺の仮の名前さ……甘くて芯があるのさ……君だけの名前を、僕にくれるかい……?",
		KitName:     "初めてでも安心!収穫キット",
		SeasonFrom:  1,
		SeasonTo:    12,
	},
}

Functions

func NewDB

func NewDB() (*gorm.DB, error)

NewDB はMySQLへ接続し、gormのマッピングオブジェクトを生成します。

func ResetDB

func ResetDB(c echo.Context) error

Types

type CultivationRepository

type CultivationRepository struct {
	// contains filtered or unexported fields
}

CultivationRepository は repository.CultivationRepository を満たす構造体です。

func NewCultivationRepository

func NewCultivationRepository(db *gorm.DB) *CultivationRepository

NewCultivationRepository はCultivationRepositoryのポインタを生成する関数です。

func (*CultivationRepository) CheckByIDUID

func (r *CultivationRepository) CheckByIDUID(id int, uid int) (bool, error)

CheckByIDUID は栽培している植物にid, user_idの組のデータが存在すればtrue、なければfalseを返却します。

func (*CultivationRepository) DeleteByID

func (r *CultivationRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ栽培している植物を削除します。

func (*CultivationRepository) FindAllByUID

func (r *CultivationRepository) FindAllByUID(uid int) (*entity.Cultivations, error)

FindAllByUID は指定されたUser.IDを持つ栽培している植物の一覧を取得します。

func (*CultivationRepository) FindByID

func (r *CultivationRepository) FindByID(id int) (*entity.Cultivation, error)

FindByID は指定されたIDを持つ栽培している植物を取得します。

func (*CultivationRepository) Store

func (r *CultivationRepository) Store(cultivation *entity.Cultivation) (*entity.Cultivation, error)

Store は栽培している植物を新規保存します。

func (*CultivationRepository) UpdateByID

func (r *CultivationRepository) UpdateByID(cultivation *entity.Cultivation) (*entity.Cultivation, error)

UpdateByID は栽培している植物の情報を更新します。

type HarvestingRepository

type HarvestingRepository struct {
	// contains filtered or unexported fields
}

HarvestingRepository は repository.HarvestingRepository を満たす構造体です。

func NewHarvestingRepository

func NewHarvestingRepository(db *gorm.DB) *HarvestingRepository

NewHarvestingRepository はHarvestingRepositoryのポインタを生成する関数です。

func (*HarvestingRepository) DeleteByID

func (r *HarvestingRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ収穫の記録を削除します。

func (*HarvestingRepository) FindAll

func (r *HarvestingRepository) FindAll() (*entity.Harvestings, error)

FindAll は指定されたIDを持つ収穫の記録を取得します。

func (*HarvestingRepository) FindByID

func (r *HarvestingRepository) FindByID(id int) (*entity.Harvesting, error)

FindByID は指定されたIDを持つ収穫の記録を取得します。

func (*HarvestingRepository) Store

func (r *HarvestingRepository) Store(harvesting *entity.Harvesting) (*entity.Harvesting, error)

Store は収穫の記録を新規保存します。

func (*HarvestingRepository) UpdateByID

func (r *HarvestingRepository) UpdateByID(harvesting *entity.Harvesting) (*entity.Harvesting, error)

UpdateByID は収穫の記録の情報を更新します。

type PlantRepository

type PlantRepository struct {
	// contains filtered or unexported fields
}

PlantRepository は repository.PlantRepository を満たす構造体です。

func NewPlantRepository

func NewPlantRepository(db *gorm.DB) *PlantRepository

NewPlantRepository はPlantRepositoryのポインタを生成する関数です。

func (*PlantRepository) DeleteByID

func (r *PlantRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ植物を削除します。

func (*PlantRepository) FindAll

func (r *PlantRepository) FindAll() (*entity.Plants, error)

FindAll は指定されたIDを持つ植物を取得します。

func (*PlantRepository) FindByID

func (r *PlantRepository) FindByID(id int) (*entity.Plant, error)

FindByID は指定されたIDを持つ植物を取得します。

func (*PlantRepository) Store

func (r *PlantRepository) Store(plant *entity.Plant) (*entity.Plant, error)

Store は植物を新規保存します。

func (*PlantRepository) UpdateByID

func (r *PlantRepository) UpdateByID(plant *entity.Plant) (*entity.Plant, error)

UpdateByID は植物の情報を更新します。

type SeasonRepository

type SeasonRepository struct {
	// contains filtered or unexported fields
}

SeasonRepository は repository.SeasonRepository を満たす構造体です。

func NewSeasonRepository

func NewSeasonRepository(db *gorm.DB) *SeasonRepository

NewSeasonRepository はSeasonRepositoryのポインタを生成する関数です。

func (*SeasonRepository) DeleteByID

func (r *SeasonRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ季節を削除します。

func (*SeasonRepository) FindAll

func (r *SeasonRepository) FindAll() (*entity.Seasons, error)

FindAll は指定されたIDを持つ季節を取得します。

func (*SeasonRepository) FindByID

func (r *SeasonRepository) FindByID(id int) (*entity.Season, error)

FindByID は指定されたIDを持つ季節を取得します。

func (*SeasonRepository) Store

func (r *SeasonRepository) Store(season *entity.Season) (*entity.Season, error)

Store は季節を新規保存します。

func (*SeasonRepository) UpdateByID

func (r *SeasonRepository) UpdateByID(season *entity.Season) (*entity.Season, error)

UpdateByID は季節の情報を更新します。

type TemperatureRepository

type TemperatureRepository struct {
	// contains filtered or unexported fields
}

TemperatureRepository は repository.TemperatureRepository を満たす構造体です。

func NewTemperatureRepository

func NewTemperatureRepository(db *gorm.DB) *TemperatureRepository

NewTemperatureRepository はTemperatureRepositoryのポインタを生成する関数です。

func (*TemperatureRepository) DeleteByID

func (r *TemperatureRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ気温を削除します。

func (*TemperatureRepository) FindAll

FindAll は指定されたIDを持つ気温を取得します。

func (*TemperatureRepository) FindByID

func (r *TemperatureRepository) FindByID(id int) (*entity.Temperature, error)

FindByID は指定されたIDを持つ気温を取得します。

func (*TemperatureRepository) Store

func (r *TemperatureRepository) Store(temperature *entity.Temperature) (*entity.Temperature, error)

Store は気温を新規保存します。

func (*TemperatureRepository) UpdateByID

func (r *TemperatureRepository) UpdateByID(temperature *entity.Temperature) (*entity.Temperature, error)

UpdateByID は気温の情報を更新します。

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

UserRepository は repository.UserRepository を満たす構造体です。

func NewUserRepository

func NewUserRepository(db *gorm.DB) *UserRepository

NewUserRepository はUserRepositoryのポインタを生成する関数です。

func (*UserRepository) DeleteByID

func (r *UserRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つユーザを削除します。

func (*UserRepository) FindAll

func (r *UserRepository) FindAll() (*entity.Users, error)

FindAll は指定されたIDを持つユーザを取得します。

func (*UserRepository) FindByID

func (r *UserRepository) FindByID(id int) (*entity.User, error)

FindByID は指定されたIDを持つユーザを取得します。

func (*UserRepository) FindIDByUID

func (r *UserRepository) FindIDByUID(uid string) (int, error)

FindIDByUID は指定されたUIDを持つユーザIDを取得します。

func (*UserRepository) Store

func (r *UserRepository) Store(user *entity.User) (*entity.User, error)

Store はユーザを新規保存します。

func (*UserRepository) UpdateByID

func (r *UserRepository) UpdateByID(user *entity.User) (*entity.User, error)

UpdateByID はユーザの情報を更新します。

type WaterRepository

type WaterRepository struct {
	// contains filtered or unexported fields
}

WaterRepository は repository.WaterRepository を満たす構造体です。

func NewWaterRepository

func NewWaterRepository(db *gorm.DB) *WaterRepository

NewWaterRepository はWaterRepositoryのポインタを生成する関数です。

func (*WaterRepository) DeleteByID

func (r *WaterRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ水分量を削除します。

func (*WaterRepository) FindAll

func (r *WaterRepository) FindAll() (*entity.Waters, error)

FindAll は指定されたIDを持つ水分量を取得します。

func (*WaterRepository) FindByID

func (r *WaterRepository) FindByID(id int) (*entity.Water, error)

FindByID は指定されたIDを持つ水分量を取得します。

func (*WaterRepository) Store

func (r *WaterRepository) Store(water *entity.Water) (*entity.Water, error)

Store は水分量を新規保存します。

func (*WaterRepository) UpdateByID

func (r *WaterRepository) UpdateByID(water *entity.Water) (*entity.Water, error)

UpdateByID は水分量の情報を更新します。

type WateringRepository

type WateringRepository struct {
	// contains filtered or unexported fields
}

WateringRepository は repository.WateringRepository を満たす構造体です。

func NewWateringRepository

func NewWateringRepository(db *gorm.DB) *WateringRepository

NewWateringRepository はWateringRepositoryのポインタを生成する関数です。

func (*WateringRepository) DeleteByID

func (r *WateringRepository) DeleteByID(id int) error

DeleteByID は指定されたIDを持つ水やりの記録を削除します。

func (*WateringRepository) FindAll

func (r *WateringRepository) FindAll() (*entity.Waterings, error)

FindAll は指定されたIDを持つ水やりの記録を取得します。

func (*WateringRepository) FindByID

func (r *WateringRepository) FindByID(id int) (*entity.Watering, error)

FindByID は指定されたIDを持つ水やりの記録を取得します。

func (*WateringRepository) Store

func (r *WateringRepository) Store(watering *entity.Watering) (*entity.Watering, error)

Store は水やりの記録を新規保存します。

func (*WateringRepository) UpdateByID

func (r *WateringRepository) UpdateByID(watering *entity.Watering) (*entity.Watering, error)

UpdateByID は水やりの記録の情報を更新します。

Jump to

Keyboard shortcuts

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