Debian Codegraph @

pdata/plog/generated_scopelogs.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package plog
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // ScopeLogs is a collection of logs from a LibraryInstrumentation.
15 //
16 // This is a reference type, if passed by value and callee modifies it the
17 // caller will see the modification.
18 //
19 // Must use NewScopeLogs function to create new instances.
20 // Important: zero-initialized instance is not valid for use.
21 type ScopeLogs struct {
22 orig *internal.ScopeLogs
23 state *internal.State
24 }
25
26 func newScopeLogs(orig *internal.ScopeLogs, state *internal.State) ScopeLogs {
27 return ScopeLogs{orig: orig, state: state}
28 }
29
30 // NewScopeLogs creates a new empty ScopeLogs.
31 //
32 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
33 // OR directly access the member if this is embedded in another struct.
34 func NewScopeLogs() ScopeLogs {
35 return newScopeLogs(internal.NewScopeLogs(), internal.NewState())
36 }
37
38 // MoveTo moves all properties from the current struct overriding the destination and
39 // resetting the current instance to its zero value
40 func (ms ScopeLogs) MoveTo(dest ScopeLogs) {
41 ms.state.AssertMutable()
42 dest.state.AssertMutable()
43 // If they point to the same data, they are the same, nothing to do.
44 if ms.orig == dest.orig {
45 return
46 }
47 internal.DeleteScopeLogs(dest.orig, false)
48 *dest.orig, *ms.orig = *ms.orig, *dest.orig
49 }
50
51 // Scope returns the scope associated with this ScopeLogs.
52 func (ms ScopeLogs) Scope() pcommon.InstrumentationScope {
53 return pcommon.InstrumentationScope(internal.NewInstrumentationScopeWrapper(&ms.orig.Scope, ms.state))
54 }
55
56 // LogRecords returns the LogRecords associated with this ScopeLogs.
57 func (ms ScopeLogs) LogRecords() LogRecordSlice {
58 return newLogRecordSlice(&ms.orig.LogRecords, ms.state)
59 }
60
61 // SchemaUrl returns the schemaurl associated with this ScopeLogs.
62 func (ms ScopeLogs) SchemaUrl() string {
63 return ms.orig.SchemaUrl
64 }
65
66 // SetSchemaUrl replaces the schemaurl associated with this ScopeLogs.
67 func (ms ScopeLogs) SetSchemaUrl(v string) {
68 ms.state.AssertMutable()
69 ms.orig.SchemaUrl = v
70 }
71
72 // CopyTo copies all properties from the current struct overriding the destination.
73 func (ms ScopeLogs) CopyTo(dest ScopeLogs) {
74 dest.state.AssertMutable()
75 internal.CopyScopeLogs(dest.orig, ms.orig)
76 }