factory

package
v0.0.0-...-b05aa3b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package factory implement a simple fatory design pattern

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Class

func Class(p interface{}) string

Class name of p, p is interface to pointer to object

func New

func New(class string) (interface{}, error)

New a object with creator

func Reflect

func Reflect(p interface{})

Reflect and register creator automatically, p is interface to pointer to object

func Register

func Register(class string, creator Creator)

Register creator for class

Types

type Creator

type Creator func() (interface{}, error)

func Get

func Get(class string) Creator

Get the facreatory method for class

Jump to

Keyboard shortcuts

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