app

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

* * @Author: TheLife * @Date: 2021/7/22 下午4:18

* * @Author: TheLife * @Date: 2021/7/19 下午5:19

Index

Constants

This section is empty.

Variables

View Source
var RestCmd = &cobra.Command{
	Use:     "create",
	Short:   "generate a RESTful codebase from SQL database",
	Long:    `generate a RESTful APIs app with gin and gorm for gophers`,
	Example: example,
	RunE: func(cmd *cobra.Command, args []string) (err error) {

		return err
	},
}

RestCmd represents the rest command

Functions

This section is empty.

Types

type App

type App struct {
	GinPlay
	Resources []Resource `json:"-"`
	Files     []string
}

func (*App) ListAppFileTree

func (app *App) ListAppFileTree() error

type AuthType

type AuthType int
const (
	AuthTypeMobile AuthType = iota + 1
	AuthTypeSecurity
)

type ColumnCommentTag

type ColumnCommentTag struct {
	State   string
	Tag     string
	Remarks string
}

type ColumnSchema

type ColumnSchema struct {
	TableName      string
	ColumnName     string
	ColumnType     string
	ColumnDataType string
	ColumnComment  string
	ColumnKey      string
}

func FetchDbColumn

func FetchDbColumn(gb GinPlay) ([]ColumnSchema, error)

func (*ColumnSchema) ToProperty

func (c *ColumnSchema) ToProperty(authTable, passwordColumn string) Property

type GinPlay

type GinPlay struct {
	AppPkg     string   `json:"app_pkg" form:"app_pkg"`
	AppDir     string   `json:"app_dir" form:"app_dir"`
	AppAddr    string   `json:"app_addr" form:"app_addr"`
	AppPort    int      `json:"app_port" form:"app_port"`
	AuthTable  string   `json:"auth_table" form:"auth_table"`
	AuthColumn string   `json:"auth_column" form:"auth_column"`
	AuthType   AuthType `json:"account_auth_type" form:"account_auth_type"`
	DbType     string   `json:"db_type" form:"db_type"`
	DbUser     string   `json:"db_user" form:"db_user"`
	DbPassword string   `json:"db_password" form:"db_password"`
	DbAddr     string   `json:"db_addr" form:"db_addr"`
	DbPort     int      `json:"db_port"  form:"db_port"`
	DbName     string   `json:"db_name" form:"db_name"`
	DbChar     string   `json:"db_char" form:"db_char"`
}

func (*GinPlay) Run

func (g *GinPlay) Run() (*App, error)

type Property

type Property struct {
	ColumnName string
	//DataType      string
	//ColumnType    string
	ColumnComment    string
	ColumnCommentTag []ColumnCommentTag
	ModelProp        string
	ModelType        string
	ModelTag         string
	//ColumnKey     string
	//ColumnType   string
	SwaggerType   string
	SwaggerFormat string
	IsAuthColumn  bool
}

type Resource

type Resource struct {
	ResourceName       string
	SimpleResourceName string
	HandlerName        string
	TableName          string
	ModelName          string
	Properties         []Property
	AppPkg             string
	HasId              bool
}

Jump to

Keyboard shortcuts

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