Categorygithub.com/go-oauth2/mysql/v4
modulepackage
4.1.0
Repository: https://github.com/go-oauth2/mysql.git
Documentation: pkg.go.dev

# README

MySQL Storage for OAuth 2.0

Build Codecov ReportCard GoDoc License

Install

$ go get -v github.com/go-oauth2/mysql/v4

Usage

package main

import (
	"github.com/go-oauth2/mysql/v4"
	"github.com/go-oauth2/oauth2/v4/manage"

	_ "github.com/go-sql-driver/mysql"
)

func main() {
	manager := manage.NewDefaultManager()

	// use mysql token store
	store := mysql.NewDefaultStore(
		mysql.NewConfig("root:123456@tcp(127.0.0.1:3306)/myapp_test?charset=utf8"),
	)

	defer store.Close()

	manager.MapTokenStorage(store)
	// ...
}

MIT License

Copyright (c) 2018 Lyric

# Functions

NewConfig create mysql configuration instance.
NewDefaultStore create mysql store instance.
NewStore create mysql store instance, config mysql configuration, tableName table name (default oauth2_token), GC time interval (in seconds, default 600).
NewStoreWithDB create mysql store instance, db sql.DB, tableName table name (default oauth2_token), GC time interval (in seconds, default 600).
NewStoreWithOpts create mysql store instance with apply custom input, db sql.DB, tableName table name (default oauth2_token), GC time interval (in seconds, default 600).
WithGCTimeInterval sets the time interval for garbage collection.
WithSQLDialect sets the database for the store.
WithTableName sets the table name for the store.

# Structs

Config mysql configuration.
Store mysql token store.
StoreItem data item.

# Interfaces

No description provided by the author