func NewStore(config *Config, gcInterval int) *Store {
	var d gorm.Dialector
	switch config.DBType {
	case MySQL:
		d = mysql.New(mysql.Config{
			DSN: config.DSN,
		})
	case PostgreSQL:
		d = postgres.New(postgres.Config{
			DSN: config.DSN,
		})
	case SQLite:
		d = sqlite.Open(config.DSN)
	case SQLServer:
		d = sqlserver.Open(config.DSN)
	default:
		fmt.Println("unsupported databases")
		return nil
	}
	db, err := gorm.Open(d, defaultConfig)
	if err != nil {
		panic(err)
	}
	s, err := db.DB()
	if err != nil {
		panic(err)
	}
	s.SetMaxIdleConns(10)
	s.SetMaxOpenConns(100)
	s.SetConnMaxLifetime(time.Hour)
	return NewStoreWithDB(config, db, gcInterval)
}
NewStore create mysql store instance,
package oauth2gorm
import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"os"
	"time"
	"github.com/go-oauth2/oauth2/v4"
	"github.com/go-oauth2/oauth2/v4/models"
	"gorm.io/driver/mysql"
	"gorm.io/driver/postgres"
	"gorm.io/driver/sqlite"
	"gorm.io/driver/sqlserver"
	"gorm.io/gorm"
	"gorm.io/gorm/logger"
)
type StoreItem struct {
	gorm.Model
	ExpiredAt int64
	Code      string `gorm:"type:varchar(512)"`
	Access    string `gorm:"type:varchar(512)"`
	Refresh   string `gorm:"type:varchar(512)"`
	Data      string `gorm:"type:text"`
}
func NewConfig(dsn string, dbType DBType, tableName string) *Config {
	return &Config{
		DSN:         dsn,
		DBType:      dbType,
		TableName:   tableName,
		MaxLifetime: time.Hour * 2,
	}
}
type Config struct {
	DSN         string
	DBType      DBType
	TableName   string
	MaxLifetime time.Duration
}
type DBType int8
const (
	MySQL = iota
	PostgreSQL
	SQLite
	SQLServer
)
var defaultConfig = &gorm.Config{
	Logger: logger.New(
		log.New(os.Stdout, "\r\n", log.LstdFlags),  
		logger.Config{
			SlowThreshold: time.Second,  
			LogLevel:      logger.Info,  
			Colorful:      true,         
		},
	),
}