github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/docs/content/api/data.md (about)

     1  ---
     2  ---
     3  
     4  Implement `data.Generator`:
     5  
     6  ```go
     7  type Generator interface {
     8      Format() (uint, string)
     9      Copy() Generator
    10      Values(RunCount) []interface{}
    11      Scan(any interface{}) error
    12      Name() string
    13  }
    14  ```
    15  
    16  Your generator does _not_ have to handle data scope.
    17  When it's called, Finch expects new values.
    18  
    19  Implement `data.Factory` to create your data generator:
    20  
    21  ```go
    22  type Factory interface {
    23      Make(name, dataKey string, params map[string]string) (Generator, error)
    24  }
    25  ```
    26  
    27  Register your data generator and its factory by calling `data.Register(name string, f Factory) error`.