2018-09-07 08:33:37 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
type LineTwitchRT struct {
|
|
|
|
Line string `db:"line" cc:"line"`
|
|
|
|
Twitch string `db:"twitch" cc:"twitch"`
|
|
|
|
Tmpl string `db:"tmpl" cc:"tmpl"`
|
|
|
|
Type string `db:"type" cc:"type"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type LineFacebookRT struct {
|
|
|
|
Line string `db:"line" cc:"line"`
|
|
|
|
Facebook string `db:"facebook" cc:"facebook"`
|
|
|
|
Tmpl string `db:"tmpl" cc:"tmpl"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type LineYoutubeRT struct {
|
|
|
|
Line string `db:"line" cc:"line"`
|
|
|
|
Youtube string `db:"youtube" cc:"youtube"`
|
|
|
|
Tmpl string `db:"tmpl" cc:"tmpl"`
|
|
|
|
}
|
2018-09-14 16:01:36 +00:00
|
|
|
|
|
|
|
// AddRT - add facebook line rt
|
|
|
|
func (p *LineFacebookRT) AddRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`insert into "public"."line_fb_rt" ("line", "facebook", "tmpl") values (:line, :facebook, :tmpl)`, p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-15 15:09:41 +00:00
|
|
|
// DelRT -
|
|
|
|
func (p *LineFacebookRT) DelRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`delete from "public"."line_fb_rt" where "line" = :line and "facebook" = :facebook`, p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetRT -
|
|
|
|
func (p *LineFacebookRT) GetRT() (err error) {
|
|
|
|
stmt, err := x.PrepareNamed(`select * from "public"."line_fb_rt" where "line" = :line and "facebook" = :facebook`)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
err = stmt.Get(p, p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-14 16:01:36 +00:00
|
|
|
// AddRT - add twitch line rt
|
|
|
|
func (p *LineTwitchRT) AddRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`insert into "public"."line_twitch_rt" ("line", "twitch", "type", "tmpl") values (:line, :twitch, :type, :tmpl)`, p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-15 15:09:41 +00:00
|
|
|
// DelRT -
|
|
|
|
func (p *LineTwitchRT) DelRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`delete from "public"."line_twitch_rt" where "line" = :line and "twitch" = :twitch and "type" = :type`, p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-14 16:01:36 +00:00
|
|
|
// AddRT - add youtube line rt
|
|
|
|
func (p *LineYoutubeRT) AddRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`insert into "public"."line_youtube_rt" ("line", "youtube", "tmpl") values (:line, :youtube, :tmpl)`, p)
|
|
|
|
return
|
|
|
|
}
|
2018-09-15 15:09:41 +00:00
|
|
|
|
|
|
|
// DelRT -
|
|
|
|
func (p *LineYoutubeRT) DelRT() (err error) {
|
|
|
|
_, err = x.NamedExec(`delete from "public"."line_youtube_rt" where "line" = :line and "youtube" = :youtube`, p)
|
|
|
|
return
|
|
|
|
}
|