memoize

package
v0.0.92 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageTemplate string

Functions

func File

func File(tpl, sourceFile, packageName string) ([]byte, error)

func Src

func Src(tpl, sourcePath string, source []byte, packageName string) ([]byte, error)

Types

type FileData

type FileData struct {
	PackageName   string
	SourcePackage string
	Imports       []PackageImport
	Functions     []FunctionDeclaration
}

type FuncValue

type FuncValue struct {
	Index int
	Name  string
	Type  string
}

func (FuncValue) ResultName

func (f FuncValue) ResultName() string

type FunctionDeclaration

type FunctionDeclaration struct {
	SourcePackage string
	IsExported    bool
	Name          string
	Params        []FuncValue
	Results       []FuncValue
	Signature     string
}

func (FunctionDeclaration) HasParams

func (f FunctionDeclaration) HasParams() bool

func (FunctionDeclaration) HasReturn

func (f FunctionDeclaration) HasReturn() bool

func (FunctionDeclaration) ParamsNames

func (f FunctionDeclaration) ParamsNames() string

func (FunctionDeclaration) ResultFields

func (f FunctionDeclaration) ResultFields() string

func (FunctionDeclaration) ResultFirstFieldDefaultValue

func (f FunctionDeclaration) ResultFirstFieldDefaultValue() string

func (FunctionDeclaration) ResultFirstFieldType

func (f FunctionDeclaration) ResultFirstFieldType() string

func (FunctionDeclaration) ResultStructFields

func (f FunctionDeclaration) ResultStructFields() string

func (FunctionDeclaration) ResultStructType

func (f FunctionDeclaration) ResultStructType() string

func (FunctionDeclaration) ResultStructVarName

func (f FunctionDeclaration) ResultStructVarName() string

func (FunctionDeclaration) SignatureWithPrefix

func (f FunctionDeclaration) SignatureWithPrefix(prefix string) string

func (FunctionDeclaration) SyncOnceVarName

func (f FunctionDeclaration) SyncOnceVarName() string

func (FunctionDeclaration) WantReturn

func (f FunctionDeclaration) WantReturn() bool

func (FunctionDeclaration) WantSyncOnce

func (f FunctionDeclaration) WantSyncOnce() bool

type MemoizeOption

type MemoizeOption func(m *Memoizer) error

func WithMaxSize

func WithMaxSize(size int) MemoizeOption

type Memoizer

type Memoizer struct {
	// contains filtered or unexported fields
}

func New

func New(options ...MemoizeOption) (*Memoizer, error)

func (*Memoizer) Do

func (m *Memoizer) Do(funcHash string, fn func() (interface{}, error)) (interface{}, error, bool)

type PackageImport

type PackageImport struct {
	Name string
	Path string
}

Directories

Path Synopsis
gen
generic
this small cli tool is specific for those functions with arbitrary parameters and with result-error tuple as return values func(x,y) => result, error it works by creating a new memoized version of the functions in the same path as memo.original.file.go some parts are specific for nuclei and hardcoded within the template
this small cli tool is specific for those functions with arbitrary parameters and with result-error tuple as return values func(x,y) => result, error it works by creating a new memoized version of the functions in the same path as memo.original.file.go some parts are specific for nuclei and hardcoded within the template
Package singleflight provides a duplicate function call suppression mechanism.
Package singleflight provides a duplicate function call suppression mechanism.

Jump to

Keyboard shortcuts

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