Return a container snapshot with a file added
(path string, source *File, opts ...ContainerWithFileOpts)
| 3154 | |
| 3155 | // Return a container snapshot with a file added |
| 3156 | func (r *Container) WithFile(path string, source *File, opts ...ContainerWithFileOpts) *Container { |
| 3157 | assertNotNil("source", source) |
| 3158 | q := r.query.Select("withFile") |
| 3159 | for i := len(opts) - 1; i >= 0; i-- { |
| 3160 | // `permissions` optional argument |
| 3161 | if !querybuilder.IsZeroValue(opts[i].Permissions) { |
| 3162 | q = q.Arg("permissions", opts[i].Permissions) |
| 3163 | } |
| 3164 | // `owner` optional argument |
| 3165 | if !querybuilder.IsZeroValue(opts[i].Owner) { |
| 3166 | q = q.Arg("owner", opts[i].Owner) |
| 3167 | } |
| 3168 | // `expand` optional argument |
| 3169 | if !querybuilder.IsZeroValue(opts[i].Expand) { |
| 3170 | q = q.Arg("expand", opts[i].Expand) |
| 3171 | } |
| 3172 | } |
| 3173 | q = q.Arg("path", path) |
| 3174 | q = q.Arg("source", source) |
| 3175 | |
| 3176 | return &Container{ |
| 3177 | query: q, |
| 3178 | } |
| 3179 | } |
| 3180 | |
| 3181 | // ContainerWithFilesOpts contains options for Container.WithFiles |
| 3182 | type ContainerWithFilesOpts struct { |
no test coverage detected