commands

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Options lib.Options

	Config *lib.Config
	// contains filtered or unexported fields
}

Cmd is a container for handling commands

func (*Cmd) Add

func (c *Cmd) Add(args []string)

Add adds an object to the database

func (*Cmd) CommandInspect

func (c *Cmd) CommandInspect(args []string)

CommandInspect is the inspect command

func (*Cmd) CommandSelect

func (c *Cmd) CommandSelect(args []string)

CommandSelect selects rows from the database

func (*Cmd) Compare

func (c *Cmd) Compare(args []string)

Compare handles the `compare` command

func (*Cmd) Data

func (c *Cmd) Data(args []string)

Data is the base command for managing static data sets

func (*Cmd) Export

func (c *Cmd) Export(args []string)

Export export SQL create statements to standard out

func (*Cmd) Gen

func (c *Cmd) Gen(args []string)

Gen handles the `gen` command

func (*Cmd) GenDals

func (c *Cmd) GenDals(g *gen.Gen, database *lib.Database)

GenDals generates dals

func (*Cmd) GenInterfaces

func (c *Cmd) GenInterfaces(g *gen.Gen)

GenInterfaces generates interfaces

func (*Cmd) GenModels

func (c *Cmd) GenModels(g *gen.Gen, database *lib.Database)

GenModels generates models

func (*Cmd) GenRepos

func (c *Cmd) GenRepos(g *gen.Gen, database *lib.Database)

GenRepos generates repos

func (*Cmd) GenRoutes

func (c *Cmd) GenRoutes(g *gen.Gen)

GenRoutes generates routes

func (*Cmd) Import

func (c *Cmd) Import(args []string)

Import fetches the sql schema from the target database (specified in dvc.toml) and from that generates the json representation at `[schema name].schema.json`

func (*Cmd) Init

func (c *Cmd) Init(args []string)

Init creates a default dvc.toml file in the CWD

func (*Cmd) Insert

func (c *Cmd) Insert(args []string)

Insert inserts data into the database

func (*Cmd) Ls

func (c *Cmd) Ls(args []string)

Ls lists database information TODO search fields TODO select from tables TODO show row counts in a table

func (*Cmd) PrintHelp

func (c *Cmd) PrintHelp(args []string)

PrintHelp prints help information

func (*Cmd) Refresh

func (c *Cmd) Refresh(args []string)

Refresh is the refresh command

func (*Cmd) Rm

func (c *Cmd) Rm(args []string)

Rm removes an object from the database dvc rm [table]

func (*Cmd) Run

func (c *Cmd) Run(inputArgs []string) (err error)

Run is the main function that handles commands arguments and routes them to their correct options and functions

type Command

type Command string

Command is a type that represents the possible commands passed in at run time

const (
	CommandAdd           Command = "add"
	CommandInspect       Command = "inspect"
	CommandRm            Command = "rm"
	CommandInit          Command = "init"
	CommandLs            Command = "ls"
	CommandImport        Command = "import"
	CommandExport        Command = "export"
	CommandGen           Command = "gen"
	CommandGenApp        Command = "app"
	CommandGenCLI        Command = "cli"
	CommandGenAPI        Command = "api"
	CommandGenDal        Command = "dal"
	CommandGenDals       Command = "dals"
	CommandGenRepos      Command = "repos"
	CommandGenModels     Command = "models"
	CommandGenInterfaces Command = "interfaces"
	CommandGenTests      Command = "tests"
	CommandGenModel      Command = "model"
	CommandGenServices   Command = "services"
	CommandGenRoutes     Command = "routes"
	CommandGenTypescript Command = "typescript"
	CommandCompare       Command = "compare"
	CommandHelp          Command = "help"
	CommandRefresh       Command = "refresh"
	CommandInstall       Command = "install"
	CommandInsert        Command = "insert"
	CommandSelect        Command = "select"
	CommandGenTSPerms    Command = "tsperms"
	CommandData          Command = "data"
)

Command Names

type SearchType

type SearchType int

SearchType is the type of search

const (
	// SearchTypeWildcard is a wildcard
	SearchTypeWildcard SearchType = iota
	// SearchTypeStartingWildcard is a wildcard at the start (e.g. `*foo`)
	SearchTypeStartingWildcard
	// SearchTypeEndingWildcard is a wildcard at the end (e.g. `foo*`)
	SearchTypeEndingWildcard
	// SearchTypeBoth is a wildcard on both the start and the end (e.g. `*foo*`)
	SearchTypeBoth
)

type TablesCache

type TablesCache struct {
	Dals   map[string]string
	Models map[string]string
}

TablesCache stores an md5 hash of the JSON representation of a table in the schema.json file These hashes are used to skip unchanged models for DAL and Model generation

func NewTablesCache

func NewTablesCache() TablesCache

NewTablesCache is a factory method for TablesCache

Jump to

Keyboard shortcuts

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