summaryrefslogtreecommitdiff
path: root/vendor/github.com/wk8/go-ordered-map/v2/yaml.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-14 14:23:28 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-14 14:23:28 +0000
commitb8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9 (patch)
tree68eaf966c80237e18993e887c8583355f0943ca7 /vendor/github.com/wk8/go-ordered-map/v2/yaml.go
parent[chore] better dns validation (#3644) (diff)
downloadgotosocial-b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9.tar.xz
bump uptrace/bun dependencies from 1.2.6 to 1.2.8 (#3645)
Diffstat (limited to 'vendor/github.com/wk8/go-ordered-map/v2/yaml.go')
-rw-r--r--vendor/github.com/wk8/go-ordered-map/v2/yaml.go71
1 files changed, 0 insertions, 71 deletions
diff --git a/vendor/github.com/wk8/go-ordered-map/v2/yaml.go b/vendor/github.com/wk8/go-ordered-map/v2/yaml.go
deleted file mode 100644
index 602247128..000000000
--- a/vendor/github.com/wk8/go-ordered-map/v2/yaml.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package orderedmap
-
-import (
- "fmt"
-
- "gopkg.in/yaml.v3"
-)
-
-var (
- _ yaml.Marshaler = &OrderedMap[int, any]{}
- _ yaml.Unmarshaler = &OrderedMap[int, any]{}
-)
-
-// MarshalYAML implements the yaml.Marshaler interface.
-func (om *OrderedMap[K, V]) MarshalYAML() (interface{}, error) {
- if om == nil {
- return []byte("null"), nil
- }
-
- node := yaml.Node{
- Kind: yaml.MappingNode,
- }
-
- for pair := om.Oldest(); pair != nil; pair = pair.Next() {
- key, value := pair.Key, pair.Value
-
- keyNode := &yaml.Node{}
-
- // serialize key to yaml, then deserialize it back into the node
- // this is a hack to get the correct tag for the key
- if err := keyNode.Encode(key); err != nil {
- return nil, err
- }
-
- valueNode := &yaml.Node{}
- if err := valueNode.Encode(value); err != nil {
- return nil, err
- }
-
- node.Content = append(node.Content, keyNode, valueNode)
- }
-
- return &node, nil
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (om *OrderedMap[K, V]) UnmarshalYAML(value *yaml.Node) error {
- if value.Kind != yaml.MappingNode {
- return fmt.Errorf("pipeline must contain YAML mapping, has %v", value.Kind)
- }
-
- if om.list == nil {
- om.initialize(0)
- }
-
- for index := 0; index < len(value.Content); index += 2 {
- var key K
- var val V
-
- if err := value.Content[index].Decode(&key); err != nil {
- return err
- }
- if err := value.Content[index+1].Decode(&val); err != nil {
- return err
- }
-
- om.Set(key, val)
- }
-
- return nil
-}