Return a container snapshot with a file added
(path string, source *File, opts ...ContainerWithFileOpts)
| 3133 | |
| 3134 | // Return a container snapshot with a file added |
| 3135 | func (r *Container) WithFile(path string, source *File, opts ...ContainerWithFileOpts) *Container { |
| 3136 | assertNotNil("source", source) |
| 3137 | q := r.query.Select("withFile") |
| 3138 | for i := len(opts) - 1; i >= 0; i-- { |
| 3139 | // `permissions` optional argument |
| 3140 | if !querybuilder.IsZeroValue(opts[i].Permissions) { |
| 3141 | q = q.Arg("permissions", opts[i].Permissions) |
| 3142 | } |
| 3143 | // `owner` optional argument |
| 3144 | if !querybuilder.IsZeroValue(opts[i].Owner) { |
| 3145 | q = q.Arg("owner", opts[i].Owner) |
| 3146 | } |
| 3147 | // `expand` optional argument |
| 3148 | if !querybuilder.IsZeroValue(opts[i].Expand) { |
| 3149 | q = q.Arg("expand", opts[i].Expand) |
| 3150 | } |
| 3151 | } |
| 3152 | q = q.Arg("path", path) |
| 3153 | q = q.Arg("source", source) |
| 3154 | |
| 3155 | return &Container{ |
| 3156 | query: q, |
| 3157 | } |
| 3158 | } |
| 3159 | |
| 3160 | // ContainerWithFilesOpts contains options for Container.WithFiles |
| 3161 | type ContainerWithFilesOpts struct { |
no test coverage detected