pygrator

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryFilename   = "entry.py"
	FeatureFilename = "feature.py"
)
View Source
const (
	MySQLConnectorEngine = "mysql.connector.django"
	TimeZoneAsiaShanghai = "Asia/Shanghai"
)
View Source
const BaseRequirements = `Django==3.2.4
mysql-connector-python==8.0.26
pytz==2021.1
sqlparse==0.4.1
`
View Source
const DeveloperScriptPattern = `` /* 314-byte string literal not displayed */
View Source
const EntrypointPattern = `` /* 848-byte string literal not displayed */
View Source
const EntrypointWithRollback = `` /* 623-byte string literal not displayed */
View Source
const ModelPattern = `` /* 225-byte string literal not displayed */
View Source
const RequirementsFilename = `requirements.txt`
View Source
const SettingsPattern = `` /* 573-byte string literal not displayed */

Variables

This section is empty.

Functions

func GenDeveloperScript

func GenDeveloperScript(rw io.ReadWriter, migration DeveloperScript) error

func GenEntrypoint

func GenEntrypoint(rw io.ReadWriter, entrypoint Entrypoint, commit bool) error

GenEntrypoint generates python module entrypoint text and write it to rw

func GenModel

func GenModel(rw io.ReadWriter, model Model) error

func GenSettings

func GenSettings(rw io.ReadWriter, settings Settings) error

Types

type DeveloperScript

type DeveloperScript struct {
	Models []string
}

type Entrypoint

type Entrypoint struct {
	DeveloperScriptFilename string
	CollectorFilename       string
}

type Fields

type Fields struct {
	Name   string
	Type   string
	Option string
}

type Model

type Model struct {
	ModelName string
	TableName string
	Fields    []*Fields
}

func CreateTableStmtToModel

func CreateTableStmtToModel(stmt *ast.CreateTableStmt) (*Model, error)

type Package

type Package struct {
	DeveloperScript   TextFile
	Requirements      []byte
	Settings          Settings
	Commit            bool
	CollectorFilename string
	// contains filtered or unexported fields
}

func (*Package) Make

func (p *Package) Make() (err error)

func (*Package) Remove

func (p *Package) Remove() error

func (*Package) Run

func (p *Package) Run() error

type Settings

type Settings struct {
	Engine   string
	User     string
	Password string
	Host     string
	Port     int
	Name     string
	TimeZone string
}

func ParseDSN

func ParseDSN(dsn string) (*Settings, error)

type TextFile

type TextFile interface {
	// GetName returns the file's base name
	GetName() string
	GetData() []byte
}

Jump to

Keyboard shortcuts

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