MCPcopy Index your code
hub / github.com/dagger/dagger / Contents

Method Contents

sdk/python/runtime/internal/dagger/dagger.gen.go:7218–7238  ·  view source on GitHub ↗

Retrieves the contents of the file.

(ctx context.Context, opts ...FileContentsOpts)

Source from the content-addressed store, hash-verified

7216
7217// Retrieves the contents of the file.
7218func (r *File) Contents(ctx context.Context, opts ...FileContentsOpts) (string, error) {
7219 if r.contents != nil {
7220 return *r.contents, nil
7221 }
7222 q := r.query.Select("contents")
7223 for i := len(opts) - 1; i >= 0; i-- {
7224 // `offsetLines` optional argument
7225 if !querybuilder.IsZeroValue(opts[i].OffsetLines) {
7226 q = q.Arg("offsetLines", opts[i].OffsetLines)
7227 }
7228 // `limitLines` optional argument
7229 if !querybuilder.IsZeroValue(opts[i].LimitLines) {
7230 q = q.Arg("limitLines", opts[i].LimitLines)
7231 }
7232 }
7233
7234 var response string
7235
7236 q = q.Bind(&response)
7237 return response, q.Execute(ctx)
7238}
7239
7240// FileDigestOpts contains options for File.Digest
7241type FileDigestOpts struct {

Callers 1

loadFilesMethod · 0.45

Calls 4

SelectMethod · 0.65
ArgMethod · 0.45
BindMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected