github.com/etecs-ru/gnomock@v0.13.2/preset/elastic/options.go (about)

     1  package elastic
     2  
     3  // Option is an optional configuration of this Gnomock preset. Use available
     4  // Options to configure the container.
     5  type Option func(*P)
     6  
     7  // WithVersion sets image version.
     8  func WithVersion(version string) Option {
     9  	return func(o *P) {
    10  		o.Version = version
    11  	}
    12  }
    13  
    14  // WithInputFile allows to load JSON data located in the provided file into
    15  // Elasticsearch container once it is up. File name is used as ingestion index.
    16  // Use multiple files to ingest JSON data into multiple indices.
    17  //
    18  // Data should be provided as a sequence of separate JSON objects, where each
    19  // object is ingested as a single entity. There is no need to make an array of
    20  // objects; a regular JSON object sequence without any separators will work.
    21  func WithInputFile(file string) Option {
    22  	return func(o *P) {
    23  		o.Inputs = append(o.Inputs, file)
    24  	}
    25  }