Package importers helps with dynamic imports for templating



    This section is empty.


    This section is empty.


    This section is empty.


    type Collection

    type Collection struct {
    	All  Set `toml:"all" json:"all,omitempty"`
    	Test Set `toml:"test" json:"test,omitempty"`
    	Singleton     Map `toml:"singleton" json:"singleton,omitempty"`
    	TestSingleton Map `toml:"test_singleton" json:"test_singleton,omitempty"`
    	BasedOnType Map `toml:"based_on_type" json:"based_on_type,omitempty"`

      Collection of imports for various templating purposes Drivers add to any and all of these, and is completely responsible for populating BasedOnType.

      func Merge

      func Merge(a, b Collection) Collection

        Merge takes two collections and creates a new one with the de-duplication contents of both.

        func NewDefaultImports

        func NewDefaultImports() Collection

          NewDefaultImports returns a default Imports struct.

          type List

          type List []string

            List of imports

            func (List) Len

            func (l List) Len() int

              Len implements sort.Interface.Len

              func (List) Less

              func (l List) Less(i, j int) bool

                Less implements sort.Interface.Less

                func (List) Swap

                func (l List) Swap(i, j int)

                  Swap implements sort.Interface.Swap

                  type Map

                  type Map map[string]Set

                    Map of file/type -> imports Map's consumers do not understand windows paths. Always specify paths using forward slash (/).

                    func MapFromInterface

                    func MapFromInterface(intf interface{}) (Map, error)

                      MapFromInterface creates a Map from a theoretical map[string]interface{} or []map[string]interface{} This is to load from a loosely defined configuration file.

                      type Set

                      type Set struct {
                      	Standard   List `toml:"standard"`
                      	ThirdParty List `toml:"third_party"`

                        Set defines the optional standard imports and thirdParty imports (from github for example)

                        func AddTypeImports

                        func AddTypeImports(a Set, typeMap map[string]Set, columnTypes []string) Set

                          AddTypeImports takes a set of imports 'a', a type -> import mapping 'typeMap' and a set of column types that are currently in use and produces a new set including both the old standard/third party, as well as the imports required for the types in use.

                          func SetFromInterface

                          func SetFromInterface(intf interface{}) (Set, error)

                            SetFromInterface creates a set from a theoretical map[string]interface{}. This is to load from a loosely defined configuration file.

                            func (Set) Format

                            func (s Set) Format() []byte

                              Format the set into Go syntax (compatible with go imports)

                              Source Files