Skip to content

Commit

Permalink
Custom table name
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Jul 6, 2021
1 parent 0ce6822 commit f85de1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type MysqlConfig struct {
User string
Password string
DB string
Table string
}

func InitConfig() {
Expand Down Expand Up @@ -71,6 +72,7 @@ func InitConfig() {
User: viper.GetString("mysql.user"),
Password: viper.GetString("mysql.password"),
DB: viper.GetString("mysql.database"),
Table: viper.GetString("mysql.table"),
}
viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) {
Expand Down
4 changes: 4 additions & 0 deletions model/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package model

import (
"github.com/guonaihong/gout"
"github.com/iyear/E5SubBot/config"
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"net/url"
Expand Down Expand Up @@ -30,6 +31,9 @@ const (
scope string = "openid offline_access mail.read user.read"
)

func (c *Client) TableName() string {
return config.Mysql.Table
}
func NewClient(clientId string, clientSecret string) *Client {
return &Client{
ClientId: clientId,
Expand Down

0 comments on commit f85de1b

Please sign in to comment.