github.com/etecs-ru/gnomock@v0.13.2/preset/mssql/options.go (about) 1 package mssql 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 // WithAdminPassword sets administrator password that can be used to connect 8 // (default: Gn0m!ck~) 9 func WithAdminPassword(password string) Option { 10 return func(o *P) { 11 o.Password = password 12 } 13 } 14 15 // WithDatabase creates a database with the provided name in the container. If 16 // not provided, "mydb" is used by default. WithQueries, if provided, runs 17 // against the new database 18 func WithDatabase(db string) Option { 19 return func(o *P) { 20 o.DB = db 21 } 22 } 23 24 // WithQueries executes the provided queries against the database created with 25 // WithDatabase, or against default "mydb" database 26 func WithQueries(queries ...string) Option { 27 return func(o *P) { 28 o.Queries = append(o.Queries, queries...) 29 } 30 } 31 32 // WithLicense sets EULA acceptance state. To accept the license, use true. See 33 // https://hub.docker.com/_/microsoft-mssql-server?tab=description for more 34 // information 35 func WithLicense(accept bool) Option { 36 return func(o *P) { 37 o.License = accept 38 } 39 } 40 41 // WithQueriesFile sets a file name to read initial queries from. Queries from 42 // this file are executed before any other queries provided in WithQueries 43 func WithQueriesFile(file string) Option { 44 return func(p *P) { 45 p.QueriesFiles = append(p.QueriesFiles, file) 46 } 47 } 48 49 // WithVersion sets image version. 50 func WithVersion(version string) Option { 51 return func(o *P) { 52 o.Version = version 53 } 54 }