example

package module
v0.0.0-...-26782db Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Example entity

Example entity for May CMF aims to show how to create custom modules and entity for MaySMF.

Usage

Get code
$ go get github.com/MayCMF/example

in app.go file:

import (
    ...
	"github.com/MayCMF/core/src/example"
	...
)

// BuildContainer Create a dependency injection container
func BuildContainer() (*dig.Container, func()) {
    ...
	err = example.InjectControllers(container)
    handleError(err)
    ...
}

in migrate.go file:

import (
	...
    example "github.com/MayCMF/example/model/impl/gorm/entity"
    ...
)

// AutoMigrate - Automatic mapping data table
func AutoMigrate(db *gorm.DB) error {
	return db.AutoMigrate(
        ...
        new(example.Example),
        ...
	).Error
}

in storage.go file:

import (
	...
    exampleIject "github.com/MayCMF/example"
    ...
)

// InitStore - Initialize storage
func InitStore(container *dig.Container) (func(), error) {
    ...
    i18nIject.InjectStarage(container)
    // Inject Example datatables to storage
    exampleIject.InjectStarage(container)
    ...
}

in web.go file:

import (
	...
	exampleApi "github.com/MayCMF/cexample/routers/api"
    ...
)

// InitWeb - Initialize the web engine
func InitWeb(container *dig.Container) *gin.Engine {
    ...
	// Registration Example /api routing
	_ = exampleApi.RegisterRouter(app, container)
    ...
}

In the future versions of CMF will be combine in one file

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectControllers

func InjectControllers(container *dig.Container) error

Inject - injection controllers implementation

func InjectStarage

func InjectStarage(container *dig.Container) error

Inject - Injection of gorm

Types

This section is empty.

Directories

Path Synopsis
routers
api
Package test Interface test How to use: go test -v
Package test Interface test How to use: go test -v

Jump to

Keyboard shortcuts

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