boilingcore

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package boilingcore has types and methods useful for generating code that acts as a fully dynamic ORM might.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DriverName       string
	Schema           string
	PkgName          string
	OutFolder        string
	BaseDir          string
	WhitelistTables  []string
	BlacklistTables  []string
	Tags             []string
	Replacements     []string
	Debug            bool
	NoTests          bool
	NoHooks          bool
	NoAutoTimestamps bool
	Wipe             bool

	Postgres PostgresConfig
	MySQL    MySQLConfig
	MSSQL    MSSQLConfig
}

Config for the running of the commands

type MSSQLConfig

type MSSQLConfig struct {
	User    string
	Pass    string
	Host    string
	Port    int
	DBName  string
	SSLMode string
}

MSSQLConfig configures a mysql database

type MySQLConfig

type MySQLConfig struct {
	User    string
	Pass    string
	Host    string
	Port    int
	DBName  string
	SSLMode string
}

MySQLConfig configures a mysql database

type PostgresConfig

type PostgresConfig struct {
	User    string
	Pass    string
	Host    string
	Port    int
	DBName  string
	SSLMode string
}

PostgresConfig configures a postgres database

type State

type State struct {
	Config *Config

	Driver  bdb.Interface
	Tables  []bdb.Table
	Dialect queries.Dialect

	Templates              *templateList
	TestTemplates          *templateList
	SingletonTemplates     *templateList
	SingletonTestTemplates *templateList

	TestMainTemplate *template.Template

	Importer importer
}

State holds the global data needed by most pieces to run

func New

func New(config *Config) (*State, error)

New creates a new state based off of the config

func (*State) Cleanup

func (s *State) Cleanup() error

Cleanup closes any resources that must be closed

func (*State) Run

func (s *State) Run(includeTests bool) error

Run executes the sqlboiler templates and outputs them to files based on the state given.

type TxtToMany

type TxtToMany struct {
	LocalTable struct {
		NameGo       string
		ColumnNameGo string
	}

	ForeignTable struct {
		NameGo            string
		NamePluralGo      string
		NameHumanReadable string
		ColumnNameGo      string
		Slice             string
	}

	Function struct {
		Name        string
		ForeignName string

		UsesBytes bool

		LocalAssignment   string
		ForeignAssignment string
	}
}

TxtToMany contains text that will be used by many-to-one relationships.

type TxtToOne

type TxtToOne struct {
	ForeignKey bdb.ForeignKey

	LocalTable struct {
		NameGo       string
		ColumnNameGo string
	}

	ForeignTable struct {
		NameGo       string
		NamePluralGo string
		ColumnNameGo string
		ColumnName   string
	}

	Function struct {
		Name        string
		ForeignName string

		UsesBytes bool

		LocalAssignment   string
		ForeignAssignment string
	}
}

TxtToOne contains text that will be used by templates for a one-to-many or a one-to-one relationship.

Jump to

Keyboard shortcuts

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