Categorygithub.com/maycmf/example
modulepackage
0.0.0-20191203174407-26782db23488
Repository: https://github.com/maycmf/example.git
Documentation: pkg.go.dev

# 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

# Packages

No description provided by the author
No description provided by the author
Package test Interface test How to use: go test -v */.

# Functions

Inject - injection controllers implementation.
Inject - Injection of gorm.