patching

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

patching provides functionality to patch resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffElem

type DiffElem struct {
	Old any
	New any
}

type FieldMapper

type FieldMapper struct {
	// contains filtered or unexported fields
}

func NewFieldMapper

func NewFieldMapper(v any) (*FieldMapper, error)

func (*FieldMapper) StructFieldName

func (f *FieldMapper) StructFieldName(tag string) (string, bool)

type PatchSet

type PatchSet struct {
	// contains filtered or unexported fields
}

func NewPatchSet

func NewPatchSet(data map[string]any) *PatchSet

func (*PatchSet) Fields

func (s *PatchSet) Fields() []string

func (*PatchSet) Set

func (s *PatchSet) Set(field string, value any)

type Patcher

type Patcher struct {
	// contains filtered or unexported fields
}

func NewPostgresPatcher added in v0.3.1

func NewPostgresPatcher() *Patcher

func NewSpannerPatcher

func NewSpannerPatcher() *Patcher

func (*Patcher) Columns added in v0.3.1

func (tm *Patcher) Columns(patchSet *PatchSet, databaseType any) string

func (*Patcher) Diff

func (tm *Patcher) Diff(old any, patchSet *PatchSet) (map[string]DiffElem, error)

func (*Patcher) Resolve

func (tm *Patcher) Resolve(pkeys PrimaryKeys, patchSet *PatchSet, databaseType any) (map[string]any, error)

Resolve returns a map with the keys set to the database struct tags found on databaseType, and the values set to the values in patchSet.

type PrimaryKeys added in v0.3.1

type PrimaryKeys map[string]any

func PKey added in v0.3.1

func PKey(key string, value any) PrimaryKeys

func (PrimaryKeys) Add added in v0.3.1

func (p PrimaryKeys) Add(key string, value any) PrimaryKeys

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL