data_mappers

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillDetailMapper

type BillDetailMapper struct {
	Id            int             `db:"id"`
	BillId        int             `db:"bill_id"`
	OrderNum      int             `db:"order_num"`
	RightToUseId  int             `db:"right_to_use_id"`
	BillingAmount decimal.Decimal `db:"billing_amount"`
	CreatedAtUpdatedAtMapper
}

func (*BillDetailMapper) SetDataToEntity

func (b *BillDetailMapper) SetDataToEntity(entity interface{}) error

type BillMapper

type BillMapper struct {
	Id                 int          `db:"id"`
	BillingDate        time.Time    `db:"billing_date"`
	UserId             int          `db:"user_id"`
	PaymentConfirmedAt sql.NullTime `db:"payment_confirmed_at"`
	CreatedAtUpdatedAtMapper
}

type ContractMapper

type ContractMapper struct {
	Id               int       `db:"id"`
	UserId           int       `db:"user_id"`
	ProductId        int       `db:"product_id"`
	ContractDate     time.Time `db:"contract_date"`
	BillingStartDate time.Time `db:"billing_start_date"`
	CreatedAtUpdatedAtMapper
}

func (*ContractMapper) SetDataToEntity

func (c *ContractMapper) SetDataToEntity(entity interface{}) error

type ContractView

type ContractView struct {
	Id               int       `db:"id"`
	ContractDate     time.Time `db:"contract_date""`
	BillingStartDate time.Time `db:"billing_start_date"`
	CreatedAt        time.Time `db:"created_at"`
	UpdatedAt        time.Time `db:"updated_at"`

	ProductId        int             `db:"product_id"`
	ProductName      string          `db:"product_name"`
	ProductPrice     decimal.Decimal `db:"product_price"`
	ProductCreatedAt time.Time       `db:"product_created_at"`
	ProductUpdatedAt time.Time       `db:"product_updated_at"`

	UserView
}

type CreatedAtUpdatedAtMapper

type CreatedAtUpdatedAtMapper struct {
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

func (*CreatedAtUpdatedAtMapper) PreInsert

func (c *CreatedAtUpdatedAtMapper) PreInsert(s gorp.SqlExecutor) error

insert時に時刻をセットするhook

func (*CreatedAtUpdatedAtMapper) PreUpdate

func (c *CreatedAtUpdatedAtMapper) PreUpdate(s gorp.SqlExecutor) error

updateに時刻をセットするhook

type EntitySetter

type EntitySetter interface {
	SetDataToEntity(entity interface{}) error
}

type ProductMapper

type ProductMapper struct {
	Id   int    `db:"id"`
	Name string `db:"name"`
	CreatedAtUpdatedAtMapper
}

type ProductPriceMonthlyMapper

type ProductPriceMonthlyMapper struct {
	ProductId int             `db:"product_id"`
	Price     decimal.Decimal `db:"price"`
	CreatedAtUpdatedAtMapper
}

type RightToUseMapper

type RightToUseMapper struct {
	Id         int       `db:"id"`
	ContractId int       `db:"contract_id"`
	ValidFrom  time.Time `db:"valid_from"`
	ValidTo    time.Time `db:"valid_to"`
	CreatedAtUpdatedAtMapper
}

func NewRightToUseMapperFromEntity

func NewRightToUseMapperFromEntity(entity *entities.RightToUseEntity) RightToUseMapper

type UserCorporationMapper

type UserCorporationMapper struct {
	UserId            int    `db:"user_id"`
	ContactParsonName string `db:"contact_person_name"`
	PresidentName     string `db:"president_name"`
	CorporationName   string `db:"corporation_name"`
	CreatedAtUpdatedAtMapper
}

func NewUserCorporationMapperFromUserCorporationEntity

func NewUserCorporationMapperFromUserCorporationEntity(entity *entities.UserCorporationEntity) *UserCorporationMapper

UserIndividualEntity Entityからデータを読み込んでUserIndividual(DBマッピング用)を作成する

type UserCorporationView

type UserCorporationView struct {
	UserMapper
	CorporationName   string `db:"corporation_name"`
	ContactPersonName string `db:"contact_person_name"`
	PresidentName     string `db:"president_name"`
}

func (*UserCorporationView) SetDataToEntity

func (u *UserCorporationView) SetDataToEntity(entity interface{}) error

type UserIndividualMapper

type UserIndividualMapper struct {
	UserId int    `db:"user_id"`
	Name   string `db:"name"`
	CreatedAtUpdatedAtMapper
}

func NewUserIndividualMapperFromUserIndividualEntity

func NewUserIndividualMapperFromUserIndividualEntity(entity *entities.UserIndividualEntity) *UserIndividualMapper

UserIndividualEntity Entityからデータを読み込んでUserIndividual(DBマッピング用)を作成する

type UserIndividualView

type UserIndividualView struct {
	UserMapper
	Name string
}

func (*UserIndividualView) SetDataToEntity

func (u *UserIndividualView) SetDataToEntity(entity interface{}) error

type UserMapper

type UserMapper struct {
	Id int `db:"id"`
	CreatedAtUpdatedAtMapper
}

func NewUserMapperFromUserCorporationEntity

func NewUserMapperFromUserCorporationEntity(userCorporation *entities.UserCorporationEntity) *UserMapper

UserCorporationEntityからデータを読み込んでUser(DBマッピング用)を作成する

func NewUserMapperFromUserIndividualEntity

func NewUserMapperFromUserIndividualEntity(userIndividual *entities.UserIndividualEntity) *UserMapper

UserIndividualEntityからデータを読み込んでUser(DBマッピング用)を作成する

func (*UserMapper) SetDataToEntity

func (u *UserMapper) SetDataToEntity(entity interface{}) error

type UserView

type UserView struct {
	UserId                  int            `db:"user_id"`
	UserType                string         `db:"user_type"`
	UserIndividualName      sql.NullString `db:"user_individual_name"`
	UserIndividualCreatedAt sql.NullTime   `db:"user_individual_created_at"`
	UserIndividualUpdatedAt sql.NullTime   `db:"user_individual_updated_at"`

	UserCorporationCorporationName    sql.NullString `db:"user_corporation_corporation_name"`
	UserCorporationContractPersonName sql.NullString `db:"user_corporation_contact_person_name"`
	UserCorporationPresidentName      sql.NullString `db:"user_corporation_president_name"`
	UserCorporationCreatedAt          sql.NullTime   `db:"user_corporation_created_at"`
	UserCorporationUpdatedAt          sql.NullTime   `db:"user_corporation_updated_at"`
}

Jump to

Keyboard shortcuts

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