mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 09:14:22 +01:00
ci: new publish method (#1451)
This commit is contained in:
29
packages/sdk/go/internal/param/field.go
Normal file
29
packages/sdk/go/internal/param/field.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package param
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type FieldLike interface{ field() }
|
||||
|
||||
// Field is a wrapper used for all values sent to the API,
|
||||
// to distinguish zero values from null or omitted fields.
|
||||
//
|
||||
// It also allows sending arbitrary deserializable values.
|
||||
//
|
||||
// To instantiate a Field, use the helpers exported from
|
||||
// the package root: `F()`, `Null()`, `Raw()`, etc.
|
||||
type Field[T any] struct {
|
||||
FieldLike
|
||||
Value T
|
||||
Null bool
|
||||
Present bool
|
||||
Raw any
|
||||
}
|
||||
|
||||
func (f Field[T]) String() string {
|
||||
if s, ok := any(f.Value).(fmt.Stringer); ok {
|
||||
return s.String()
|
||||
}
|
||||
return fmt.Sprintf("%v", f.Value)
|
||||
}
|
||||
Reference in New Issue
Block a user