core

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 15 Imported by: 0

README

core

⚙️ Core module shared across our backend projects

Installation

Adding core to a Go project is as easy as calling this command

go get github.com/cozy-hosting/core

Using the module

The project must be based on the uber-go/fx application framework

package main

import "go.uber.org/fx"

func main() {
    // Creates a new fx application
    fx.New(
        // Add the core module to the container
        core.Module,
        fx.Invoke(
            // Add this, if you want to use SwaggerUI
            core.UseSwagger,
            // Also add this, if you want to use GraphQL + Playground
            core.UseGraphQlWithPlayground,
        ),
    ).Run()
}

Contained sub-modules

The list of uber/fx modules that are currently available:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClerkModule = fx.Provide(
	NewClerkConnection,
)
View Source
var EchoModule = fx.Provide(
	UseEcho,
)
View Source
var GraphQlModule = fx.Provide(
	fx.Annotated{
		Name:   "query",
		Target: newGraphQlQuery,
	},
	fx.Annotated{
		Name:   "mutation",
		Target: newGraphQlMutation,
	},
	newGraphQlSchema,
)
View Source
var LogrusModule = fx.Provide(
	UseLogrus,
)
View Source
var MessengerModule = fx.Provide(
	newMessenger,
)

Functions

func IsDevelopment

func IsDevelopment() bool

func NewClerkConnection

func NewClerkConnection(lifecycle fx.Lifecycle, logger *logrus.Logger) clerk.Connection

func UseEcho

func UseEcho(lifecycle fx.Lifecycle, logger *logrus.Logger) *echo.Echo

func UseEnvironment

func UseEnvironment(logger *logrus.Logger)

func UseGraphQl

func UseGraphQl(schema *graphql.Schema, server *echo.Echo, logger *logrus.Logger)

func UseGraphQlWithPlayground

func UseGraphQlWithPlayground(schema *graphql.Schema, server *echo.Echo, logger *logrus.Logger)

func UseLogrus

func UseLogrus() *logrus.Logger

func UseSwagger

func UseSwagger(server *echo.Echo)

Types

This section is empty.

Jump to

Keyboard shortcuts

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