ldifdiff

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

README

ldifdiff

ldiffdiff is a fast Go (golang) library and executable that outputs the difference between two LDIF files (LDAP). Binaries of the command implementation are provided under releases.

Build Status

Usage of the ldifdiff command

$ ./ldifdiff -h
ldifdiff v0.1.0 (Claudio Ramirez <pub.claudio@gmail.com>).
Compare two LDIF files and output the differences as a valid LDIF.
Bugs to https://github.com/nxadm/ldifdiff.

       _       _       _       _       _       _       _       _
    _-(_)-  _-(_)-  _-(_)-  _-(")-  _-(_)-  _-(_)-  _-(_)-  _-(_)-
  *(___)  *(___)  *(___)  *%%%%%  *(___)  *(___)  *(___)  *(___)
  // \\   // \\   // \\   // \\   // \\   // \\   // \\   // \\

Usage:
  ldifdiff <source> <target> [-i <attributes> ...] [-d]
  ldifdiff -h
  ldifdiff -v
Options:
  -d, --dn
    Only print DNs instead of a full LDIF.
  -i <attributes>, --ignore <attributes>
	Comma separated attribute list.
	Multiple instances of this switch are allowed.
  -h, --help
  	Show this screen.
  -v, --version
  	Show version

Installation

Download the library using go: go get github.com/nxadm/ldifdiff

Import the library into your project: import "github.com/nxadm/ldifdiff"

Compile the ldiff cmd implementation: cd cmd; go build -o ldifdiff ldifdiff.go

API

The API is simple and provides four functions.

func Diff(sourceStr, targetStr string, ignoreAttr []string) (string, error)

Diff compares two LDIF strings (sourceStr and targetStr) and outputs the differences as a LDIF string. An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string, a valid LDIF, and can be added to the "target" database (the one that created targetStr) in order to make it equal to the source database (the one that created sourceStr). In case of failure, an error is provided.

func DiffFromFiles(sourceFile, targetFile string, ignoreAttr []string) (string, error)

DiffFromFiles compares two LDIF files (sourceFile and targetFile) and outputs the differences as a LDIF string. An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string, a valid LDIF, and can be added to the "target" database (the one that created targetFile) in order to make it equal to the source database (the one that created sourceFile). In case of failure, an error is provided.

func ListDiffDn(sourceStr, targetStr string, ignoreAttr []string) ([]string, error)

ListDiffDn compares two LDIF strings (sourceStr and targetStr) and outputs the differences as a list of affected DNs (Dintinguished Names). An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string slice. In case of failure, an error is provided.

func ListDiffDnFromFiles(sourceFile, targetFile string, ignoreAttr []string) ([]string, error)

ListDiffDnFromFiles compares two LDIF files (sourceFile and targetFileStr) and outputs the differences as a list of affected DNs (Dintinguished Names). An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string slice. In case of failure, an error is provided.

Documentation

Overview

Package ldiffdiff finds and outputs the difference between two LDIF files.

Index

Constants

View Source
const Author = "Claudio Ramirez <pub.claudio@gmail.com>"
View Source
const Repo = "https://github.com/nxadm/ldifdiff"
View Source
const Version = "v0.1.0"

Variables

This section is empty.

Functions

func Diff

func Diff(sourceStr, targetStr string, ignoreAttr []string) (string, error)

Diff compares two LDIF strings (sourceStr and targetStr) and outputs the differences as a LDIF string. An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string, a valid LDIF, and can be added to the "target" database (the one that created targetStr) in order to make it equal to the *source* database (the one that created sourceStr). In case of failure, an error is provided.

func DiffFromFiles

func DiffFromFiles(sourceFile, targetFile string, ignoreAttr []string) (string, error)

DiffFromFiles compares two LDIF files (sourceFile and targetFile) and outputs the differences as a LDIF string. An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string, a valid LDIF, and can be added to the "target" database (the one that created targetFile) in order to make it equal to the *source* database (the one that created sourceFile). In case of failure, an error is provided.

func ListDiffDn

func ListDiffDn(sourceStr, targetStr string, ignoreAttr []string) ([]string, error)

ListDiffDn compares two LDIF strings (sourceStr and targetStr) and outputs the differences as a list of affected DNs (Dintinguished Names). An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string slice. In case of failure, an error is provided.

func ListDiffDnFromFiles

func ListDiffDnFromFiles(sourceFile, targetFile string, ignoreAttr []string) ([]string, error)

ListDiffDnFromFiles compares two LDIF files (sourceFile and targetFileStr) and outputs the differences as a list of affected DNs (Dintinguished Names). An array of attributes can be supplied. These attributes will be ignored when comparing the LDIF strings. The output is a string slice. In case of failure, an error is provided.

Types

type Action

type Action int
const (
	Add Action = iota
	Delete
	Modify
)

type ActionEntry

type ActionEntry struct {
	Dn             string
	Action         Action
	SubActionAttrs []SubActionAttr
}

type Entries

type Entries map[string][]string

Return map with dn as key and attribute array as value

type SubAction

type SubAction int
const (
	ModifyAdd SubAction = iota
	ModifyDelete
	ModifyReplace
	None
)

type SubActionAttr

type SubActionAttr map[SubAction][]string

Directories

Path Synopsis
A simple implementation of the ldifdiff library
A simple implementation of the ldifdiff library

Jump to

Keyboard shortcuts

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