labeltile

package module
v0.0.0-...-a62c2ef Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxSessionIDKey is for handling session id in Context
	CtxSessionIDKey = "sessionID"
)

Variables

This section is empty.

Functions

func InitializeGraphQLSchema

func InitializeGraphQLSchema(container app.Container) *graphql.Schema

InitializeGraphQLSchema provides type initialization for GraphQL

func SetupGraphQLHandler

func SetupGraphQLHandler(router *gin.Engine, container app.Container)

SetupGraphQLHandler provides initializing GraphQLHandler and binding its controller and endpoint

func SetupHomeHandler

func SetupHomeHandler(router *gin.Engine, container app.Container)

SetupHomeHandler provides initializing HomeHandler and binding its controller and endpoint

func SetupOAuth2GoogleHandler

func SetupOAuth2GoogleHandler(router *gin.Engine, container app.Container)

SetupOAuth2GoogleHandler provides initializing OAuth2GoogleHandler and binding its controller and endpoint

func SetupRepositories

func SetupRepositories(container app.Container, conf *Conf)

SetupRepositories provides initializing repositories and setting to container

func SetupSessionMiddleware

func SetupSessionMiddleware(sessionProvider interface {
	SessionStorage() app.SessionStorage
}) gin.HandlerFunc

SetupSessionMiddleware provides session storage operation request by request

func SetupUserTokenMiddleware

func SetupUserTokenMiddleware(tokenProvider interface {
	UserTokenSerializer() app.UserTokenSerializer
}) gin.HandlerFunc

SetupUserTokenMiddleware provides deserialization token from header and serialization token to header

func SetupUserTokenSerializer

func SetupUserTokenSerializer(container app.Container, conf *Conf)

SetupUserTokenSerializer provides setting UserTokenSerializer into containter

Types

type Conf

type Conf struct {
	Server   ServerConf `toml:"server"`
	JWT      JWTConf    `toml:"jwt"`
	OAuth2   OAuth2Conf `toml:"oauth2"`
	Database Database   `toml:"database"`
}

Conf is configuration binder

func NewConf

func NewConf(path string) (*Conf, error)

NewConf returns Conf object with validation

type ContainerInjector

type ContainerInjector func(app.Container, *Conf)

ContainerInjector is alias for infra module injection using Functional Option Pattern

type Database

type Database struct {
	Driver string `toml:"driver"`
	Dsn    string `toml:"dsn"`
}

type GraphQL

type GraphQL struct {
	Variables map[string]interface{}
	Query     string
	Schema    *graphql.Schema
}

GraphQL provides variable, query and user grouping per request for GraphQL execution

func NewGraphQLRequest

func NewGraphQLRequest(schema *graphql.Schema, body io.ReadCloser) (*GraphQL, error)

NewGraphQLRequest returns Request object with json and token validation

func (*GraphQL) Run

func (g *GraphQL) Run(ctx context.Context) map[string]interface{}

Run provides GraphQL request with resolver

type GraphQLHandler

type GraphQLHandler struct {
	// contains filtered or unexported fields
}

GraphQLHandler provides controllers for graphql requests

func (*GraphQLHandler) Run

func (h *GraphQLHandler) Run(c *gin.Context)

Run is controller for graphql request

type HomeHandler

type HomeHandler struct {
	// contains filtered or unexported fields
}

HomeHandler provides controllers for toppage

func (*HomeHandler) Top

func (h *HomeHandler) Top(c *gin.Context)

Top is toppage controller

type JWTConf

type JWTConf struct {
	SecretKey     string `toml:"secret_key"`
	ExpireHour    uint32 `toml:"expire_hour"`
	SigningMethod string `toml:"signing_method"`
}

JWTConf provides configuration for JSON Web Token

func (JWTConf) IsValid

func (c JWTConf) IsValid() bool

IsValid returns whether JWTConf data structure is valid or not

type Labeltile

type Labeltile struct {
	// contains filtered or unexported fields
}

Labeltile is main interface of this application

func NewLabeltile

func NewLabeltile(conf *Conf, injectFns ...ContainerInjector) *Labeltile

NewLabeltile returns Labeltile object

func (*Labeltile) Close

func (l *Labeltile) Close()

func (*Labeltile) SetupRoutes

func (l *Labeltile) SetupRoutes(injectFns ...RouteInjector)

SetupRoutes provides filling routing in gin framework

type OAuth2Conf

type OAuth2Conf struct {
	Google OAuth2GoogleConf `toml:"google"`
}

OAuth2Conf provides oauth2 conf section

type OAuth2GoogleConf

type OAuth2GoogleConf struct {
	ClientID     string `toml:"client_id"`
	ClientSecret string `toml:"client_secret"`
	RedirectURL  string `toml:"redirect_url"`
}

OAuth2GoogleConf provides configuration for google oauth2

func (OAuth2GoogleConf) IsValid

func (c OAuth2GoogleConf) IsValid() bool

IsValid returns whether OAuth2GoogleConf data structure is valid or not

type OAuth2GoogleHandler

type OAuth2GoogleHandler struct {
	// contains filtered or unexported fields
}

OAuth2GoogleHandler provides controllers for oauth authorization by google

func (*OAuth2GoogleHandler) Access

func (h *OAuth2GoogleHandler) Access(c *gin.Context)

Access is controller for oauth page redirection to google

func (*OAuth2GoogleHandler) Callback

func (h *OAuth2GoogleHandler) Callback(c *gin.Context)

Callback is controller for rediret page from google when authorized

type RouteInjector

type RouteInjector func(*gin.Engine, app.Container)

RouteInjector is alias for binding endpoint and controller implementation using Functional Option Pattern

type ServerConf

type ServerConf struct {
	Port     uint16 `toml:"port"`
	Template string `toml:"template"`
}

ServerConf provides configuration for Web Server

func (ServerConf) IsValid

func (c ServerConf) IsValid() bool

IsValid returns whether ServerConf data structure is valid or not

type SessionMiddleware

type SessionMiddleware struct {
	// contains filtered or unexported fields
}

SessionMiddleware provides framework's whole request filter using SessionStorage

func (*SessionMiddleware) Execute

func (m *SessionMiddleware) Execute(c *gin.Context)

Execute provides wrapping request by SessionMiddleware

type UserTokenMiddleware

type UserTokenMiddleware struct {
	// contains filtered or unexported fields
}

UserTokenMiddleware provides framework's whole request filter using UserTokenSerializer

func (*UserTokenMiddleware) Execute

func (m *UserTokenMiddleware) Execute(c *gin.Context)

Execute provides wrapping request by UserTokenMiddleware

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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