v1.0.0 Latest Latest

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0, MIT Imports: 2 Imported by: 9



Package inserter provides some common inserter functions for mmdbwriter.Tree.



This section is empty.


This section is empty.


func Remove

Remove any records for the network being inserted.


type Func

type Func func(mmdbtype.DataType) (mmdbtype.DataType, error)

Func is a function that returns the data type to be inserted into an mmdbwriter.Tree using some conflict resolution strategy.

func DeepMergeWith

func DeepMergeWith(newValue mmdbtype.DataType) Func

DeepMergeWith creates an inserter that will recursively update an existing value. Map and Slice values will be merged recursively. Other values will be replaced by the new value.

func ReplaceWith

func ReplaceWith(value mmdbtype.DataType) Func

ReplaceWith generates an inserter function that replaces the existing value with the new value.

func TopLevelMergeWith

func TopLevelMergeWith(newValue mmdbtype.DataType) Func

TopLevelMergeWith creates an inserter for Map values that will update an existing Map by adding the top-level keys and values from the new Map, replacing any existing values for the keys.

Both the new and existing value must be a Map. An error will be returned otherwise.

type FuncGenerator

type FuncGenerator func(value mmdbtype.DataType) Func

FuncGenerator is a function that generates an Func given a value.

Jump to

Keyboard shortcuts

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