{"modulePath":"github.com/viant/xdatly/handler","version":"v0.0.0-20261113075720-88fc13248650","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package differ\n\n## Constants\n\n```go\nconst (\n\t//ChangeTypeCreate defines create change type\n\tChangeTypeCreate = ChangeType(\"create\")\n\t//ChangeTypeUpdate defines update change type\n\tChangeTypeUpdate = ChangeType(\"update\")\n\t//ChangeTypeDelete defines delete change type\n\tChangeTypeDelete = ChangeType(\"delete\")\n)\n```\n\n```go\nconst (\n\t//PathKindRoot defines root path kind\n\tPathKindRoot = PathKind(iota)\n\t//PathKinField defines field path kind\n\tPathKinField\n\t//PathKindKey defines key path kind\n\tPathKindKey\n\t//PathKindIndex defines index path kind\n\tPathKindIndex\n)\n```\n\n## Types\n\n```go\ntype Change struct {\n\tType  ChangeType\n\tPath  *Path\n\tFrom  interface{}\n\tTo    interface{}\n\tError string\n}\n```\nChange represents a change\n\n```go\ntype ChangeLog struct {\n\tChanges []*Change\n}\n```\nChangeLog represents a change log\n\n```go\nfunc (l *ChangeLog) ToChangeRecords(options ...LogOption) []*ChangeRecord\n```\nToChangeRecords converts changeLog to change records\n\n```go\ntype ChangeRecord struct {\n\tSource   string      `json:\",omitempty\"`\n\tSourceID interface{} `json:\",omitempty\"`\n\tUserID   interface{} `json:\",omitempty\"`\n\tPath     string\n\tChange   string\n\tFrom     interface{} `json:\",omitempty\"`\n\tTo       interface{} `json:\",omitempty\"`\n\tError    string      `json:\",omitempty\"`\n}\n```\nChangeRecord defines a change record\n\n```go\ntype ChangeType string\n```\nChangeType defines a change type\n\n```go\ntype Differ interface {\n\tDiff(ctx context.Context, from, to interface{}, options ...Option) *ChangeLog\n}\n```\n\n```go\ntype LogOption func(l *logOptions)\n```\n\n```go\nfunc WithSource(source string) LogOption\n```\n\n```go\nfunc WithSourceID(id interface{}) LogOption\n```\n\n```go\nfunc WithUserID(userID interface{}) LogOption\n```\n\n```go\ntype Option func(o *Options)\n```\nOption defines validator option\n\n```go\nfunc WithSetMarker(f bool) Option\n```\nWithSetMarker creates with shallow option\n\n```go\nfunc WithShallow(f bool) Option\n```\nWithShallow creates with shallow option\n\n```go\ntype Options struct {\n\tWithShallow   bool\n\tWithSetMarker bool\n}\n```\nOptions defins validator options\n\n```go\nfunc (o *Options) Apply(opts ...Option)\n```\n\n```go\ntype Path struct {\n\tKind  PathKind    `json:\",omitempty\"`\n\tPath  *Path       `json:\",omitempty\"`\n\tName  string      `json:\",omitempty\"`\n\tIndex int         `json:\",omitempty\"`\n\tKey   interface{} `json:\",omitempty\"`\n}\n```\nPath represents an arbitrary data structure path\n\n```go\nfunc (p *Path) Element(index int) *Path\n```\nElement adds slice element node\n\n```go\nfunc (p *Path) Entry(name string) *Path\n```\nEntry adds map entry node\n\n```go\nfunc (p *Path) Field(name string) *Path\n```\nField add fields node\n\n```go\nfunc (p *Path) String() string\n```\nString stringifies a path\n\n```go\ntype PathKind int\n```\nPathKind defines patch kind\n\n```go\ntype Service struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(differ Differ) *Service\n```\n\n```go\nfunc (s *Service) Diff(ctx context.Context, from, to interface{}, options ...Option) *ChangeLog\n```\n\n","path":"github.com/viant/xdatly/handler/differ","name":"differ","synopsis":"","isRedistributable":true}
