github.com/ManabuSeki/goa-v1@v1.4.3/goagen/gen_js/options.go (about)

     1  package genjs
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/goadesign/goa/design"
     7  )
     8  
     9  //Option a generator option definition
    10  type Option func(*Generator)
    11  
    12  //API The API definition
    13  func API(API *design.APIDefinition) Option {
    14  	return func(g *Generator) {
    15  		g.API = API
    16  	}
    17  }
    18  
    19  //OutDir Path to output directory
    20  func OutDir(outDir string) Option {
    21  	return func(g *Generator) {
    22  		g.OutDir = outDir
    23  	}
    24  }
    25  
    26  //Timeout Timeout used by JavaScript client when making requests
    27  func Timeout(timeout time.Duration) Option {
    28  	return func(g *Generator) {
    29  		g.Timeout = timeout
    30  	}
    31  }
    32  
    33  //Scheme Scheme used by JavaScript client
    34  func Scheme(scheme string) Option {
    35  	return func(g *Generator) {
    36  		g.Scheme = scheme
    37  	}
    38  }
    39  
    40  //Host addressed by JavaScript client
    41  func Host(host string) Option {
    42  	return func(g *Generator) {
    43  		g.Host = host
    44  	}
    45  }
    46  
    47  //NoExample Do not generate an HTML example file
    48  func NoExample(noExample bool) Option {
    49  	return func(g *Generator) {
    50  		g.NoExample = noExample
    51  	}
    52  }