Documentation
¶
Overview ¶
Package gedcom defines the core data types for representing GEDCOM genealogy data.
This package provides the fundamental structures for working with GEDCOM files, including individuals, families, sources, events, and other genealogical records. It supports GEDCOM versions 5.5, 5.5.1, and 7.0.
The main entry point is the Document type, which contains a parsed GEDCOM file with all its records. Individual records can be accessed through helper methods or by using the XRefMap for cross-reference lookup.
Example usage:
// After decoding a GEDCOM file
doc, _ := decoder.Decode(reader)
// Access individuals
for _, individual := range doc.Individuals() {
fmt.Printf("Name: %s\n", individual.Name)
}
// Lookup by cross-reference
person := doc.GetIndividual("@I1@")
if person != nil {
fmt.Printf("Found: %s\n", person.Name)
}
Index ¶
- func AstronomicalYear(year int, isBC bool) int
- func FrenchToJDN(year, month, day int) int
- func FromAstronomicalYear(astroYear int) (year int, isBC bool)
- func GregorianToJDN(year, month, day int) int
- func HebrewDaysInMonth(year, month int) int
- func HebrewDaysInYear(year int) int
- func HebrewMonthsInYear(year int) int
- func HebrewToJDN(year, month, day int) int
- func IsFrenchLeapYear(year int) bool
- func IsHebrewLeapYear(year int) bool
- func JDNToFrench(jdn int) (year, month, day int)
- func JDNToGregorian(jdn int) (year, month, day int)
- func JDNToHebrew(jdn int) (year, month, day int)
- func JDNToJulian(jdn int) (year, month, day int)
- func JulianToJDN(year, month, day int) int
- func ValidateBirthBeforeDeath(birth, death *Date) error
- func ValidateMarriageDates(marriage, spouseBirth1, spouseBirth2 *Date, minMarriageAge int) error
- func ValidateParentChildDates(parentBirth, childBirth *Date, minParentAge int) error
- func YearsBetween(d1, d2 *Date) (years int, exact bool, err error)
- type Address
- type AncestryAPID
- type Association
- type Attribute
- type Calendar
- type ChangeDate
- type ConversionNote
- type ConversionReport
- func (r *ConversionReport) AddApproximated(note ConversionNote)
- func (r *ConversionReport) AddDataLoss(d DataLossItem)
- func (r *ConversionReport) AddDropped(note ConversionNote)
- func (r *ConversionReport) AddNormalized(note ConversionNote)
- func (r *ConversionReport) AddPreserved(note ConversionNote)
- func (r *ConversionReport) AddTransformation(t Transformation)
- func (r *ConversionReport) AllNotes() []ConversionNote
- func (r *ConversionReport) HasDataLoss() bool
- func (r *ConversionReport) String() string
- type Coordinates
- type CropRegion
- type DataLossItem
- type Date
- func (d *Date) Compare(other *Date) int
- func (d *Date) IsAfter(other *Date) bool
- func (d *Date) IsBefore(other *Date) bool
- func (d *Date) IsEqual(other *Date) bool
- func (d *Date) String() string
- func (d *Date) ToGregorian() (*Date, error)
- func (d *Date) ToTime() (time.Time, error)
- func (d *Date) Validate() error
- type DateModifier
- type Document
- func (d *Document) Families() []*Family
- func (d *Document) GetFamily(xref string) *Family
- func (d *Document) GetIndividual(xref string) *Individual
- func (d *Document) GetMediaObject(xref string) *MediaObject
- func (d *Document) GetNote(xref string) *Note
- func (d *Document) GetRecord(xref string) *Record
- func (d *Document) GetRepository(xref string) *Repository
- func (d *Document) GetSharedNote(xref string) *SharedNote
- func (d *Document) GetSource(xref string) *Source
- func (d *Document) GetSubmitter(xref string) *Submitter
- func (d *Document) Individuals() []*Individual
- func (d *Document) MediaObjects() []*MediaObject
- func (d *Document) Notes() []*Note
- func (d *Document) Repositories() []*Repository
- func (d *Document) SharedNotes() []*SharedNote
- func (d *Document) Sources() []*Source
- func (d *Document) Submitters() []*Submitter
- type Encoding
- type Event
- type EventType
- type ExternalID
- type Family
- type FamilyLink
- type Header
- type Individual
- func (i *Individual) BirthDate() *Date
- func (i *Individual) BirthEvent() *Event
- func (i *Individual) Children(doc *Document) []*Individual
- func (i *Individual) DeathDate() *Date
- func (i *Individual) DeathEvent() *Event
- func (i *Individual) FamilySearchURL() string
- func (i *Individual) ParentalFamilies(doc *Document) []*Family
- func (i *Individual) Parents(doc *Document) []*Individual
- func (i *Individual) SpouseFamilies(doc *Document) []*Family
- func (i *Individual) Spouses(doc *Document) []*Individual
- type InlineRepository
- type LDSOrdinance
- type LDSOrdinanceType
- type MediaFile
- type MediaLink
- type MediaObject
- type MediaTranslation
- type Note
- type PersonalName
- type PlaceDetail
- type Record
- func (r *Record) GetFamily() (*Family, bool)
- func (r *Record) GetIndividual() (*Individual, bool)
- func (r *Record) GetMediaObject() (*MediaObject, bool)
- func (r *Record) GetNote() (*Note, bool)
- func (r *Record) GetRepository() (*Repository, bool)
- func (r *Record) GetSharedNote() (*SharedNote, bool)
- func (r *Record) GetSource() (*Source, bool)
- func (r *Record) GetSubmitter() (*Submitter, bool)
- func (r *Record) IsFamily() bool
- func (r *Record) IsIndividual() bool
- func (r *Record) IsSharedNote() bool
- func (r *Record) IsSource() bool
- type RecordType
- type Repository
- type SchemaDefinition
- type SharedNote
- type SharedNoteTranslation
- type Source
- type SourceCitation
- type SourceCitationData
- type Submitter
- type Tag
- type Trailer
- type Transformation
- type Transliteration
- type Vendor
- type Version
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AstronomicalYear ¶ added in v0.4.0
AstronomicalYear converts a GEDCOM year (with IsBC flag) to astronomical year. GEDCOM uses historical year numbering (1 BC, 2 BC, etc. with no year 0), while astronomical year numbering includes year 0 (0 = 1 BC, -1 = 2 BC, etc.).
Conversion rules:
- AD years: unchanged (e.g., 2000 AD = 2000)
- BC years: year 0 = 1 BC, so n BC = -(n-1) Examples: 1 BC = 0 2 BC = -1 44 BC = -43
Parameters:
- year: GEDCOM year (always positive, e.g., 44 for "44 BC")
- isBC: true if the year is BC/BCE
Returns:
- astronomical year (may be negative or zero)
Example:
AstronomicalYear(44, true) = -43 // 44 BC AstronomicalYear(2000, false) = 2000 // 2000 AD
func FrenchToJDN ¶ added in v0.4.0
FrenchToJDN converts a French Republican calendar date to Julian Day Number. Month 13 (COMP) represents the complementary days (1-5 or 1-6 in leap years).
The French Republican calendar was used in France from 1792-1805. It has:
- 12 months of exactly 30 days each
- 5 complementary days (6 in leap years) at the end of the year
- Epoch: 1 Vendémiaire 1 = September 22, 1792 (Gregorian) = JDN 2375840
Parameters:
- year: French Republican year (1 = 1792-1793)
- month: 1-13 (1-12 are regular months, 13 = complementary days)
- day: 1-30 for months 1-12, 1-5 (or 1-6 in leap years) for month 13
Returns:
- jdn: Julian Day Number
Example:
FrenchToJDN(1, 1, 1) = 2375840 // 1 Vendémiaire 1 (Sep 22, 1792) FrenchToJDN(8, 1, 1) = 2378396 // 1 Vendémiaire 8 (Sep 22, 1799) FrenchToJDN(14, 1, 1) = 2380587 // 1 Vendémiaire 14 (Sep 22, 1805)
func FromAstronomicalYear ¶ added in v0.4.0
FromAstronomicalYear converts astronomical year back to GEDCOM representation. Inverse of AstronomicalYear.
Conversion rules:
- Positive years and zero: BC years 0 = 1 BC -1 = 2 BC -43 = 44 BC
- Positive years: AD years (unchanged)
Parameters:
- astroYear: astronomical year (may be negative or zero)
Returns:
- year: GEDCOM year (always positive)
- isBC: true if the year is BC/BCE
Example:
FromAstronomicalYear(-43) = (44, true) // 44 BC FromAstronomicalYear(2000) = (2000, false) // 2000 AD
func GregorianToJDN ¶ added in v0.4.0
GregorianToJDN converts a Gregorian date to Julian Day Number. Uses astronomical year numbering (year 0 exists, negative years for BC).
Reference: Dershowitz & Reingold "Calendrical Calculations"
Parameters:
- year: astronomical year (0 = 1 BC, -1 = 2 BC, etc.)
- month: 1-12 (January = 1, December = 12)
- day: 1-31 depending on month
Returns:
- jdn: Julian Day Number
Example:
GregorianToJDN(2000, 1, 1) = 2451545 // January 1, 2000 GregorianToJDN(1970, 1, 1) = 2440588 // Unix epoch
func HebrewDaysInMonth ¶ added in v0.4.0
HebrewDaysInMonth returns the number of days in a Hebrew month (29 or 30).
Month lengths vary based on the year type (deficient, regular, complete):
- Tishrei (1), Shevat (5), Nisan (8), Sivan (10), Av (12): always 30 days
- Tevet (4), Iyar (9), Tammuz (11), Elul (13): always 29 days
- Cheshvan (2): 29 (deficient/regular) or 30 (complete)
- Kislev (3): 29 (deficient) or 30 (regular/complete)
- Adar (6): 29 days in regular years, 30 days in leap years (as Adar I)
- Adar II (7): only exists in leap years, 29 days
Parameters:
- year: Hebrew year
- month: Month number (1-13, using GEDCOM numbering where Tishrei=1)
Returns:
- Number of days in the month (29 or 30)
Example:
HebrewDaysInMonth(5785, 1) = 30 // Tishrei always has 30 days HebrewDaysInMonth(5785, 2) = 29 // Cheshvan varies by year type
func HebrewDaysInYear ¶ added in v0.4.0
HebrewDaysInYear returns the number of days in a Hebrew year (353-385).
Hebrew year lengths:
- Regular years: 353 (deficient), 354 (regular), 355 (complete)
- Leap years: 383 (deficient), 384 (regular), 385 (complete)
The variation comes from the dehiyot (postponement rules) which adjust the lengths of Cheshvan and Kislev to ensure proper calendar alignment.
Parameters:
- year: Hebrew year
Returns:
- Number of days in the year (353-385)
Example:
HebrewDaysInYear(5785) = 355 // Regular complete year HebrewDaysInYear(5784) = 385 // Leap complete year
func HebrewMonthsInYear ¶ added in v0.4.0
HebrewMonthsInYear returns the number of months in a Hebrew year (12 or 13).
Regular years have 12 months, leap years have 13 months (with Adar I and Adar II).
Parameters:
- year: Hebrew year
Returns:
- 12 for regular years, 13 for leap years
Example:
HebrewMonthsInYear(5784) = 13 // Leap year HebrewMonthsInYear(5785) = 12 // Regular year
func HebrewToJDN ¶ added in v0.4.0
HebrewToJDN converts a Hebrew calendar date to Julian Day Number. Month numbering follows GEDCOM convention: Tishrei=1, ..., Elul=13. In leap years, Adar I=6 and Adar II=7.
The Hebrew calendar is a lunisolar calendar with years of 12 or 13 months. The epoch is Tishrei 1, 1 = Monday, September 7, 3761 BC (Julian) = JDN 347998.
Parameters:
- year: Hebrew year
- month: Month number (1-13, Tishrei=1 per GEDCOM convention)
- day: Day of month (1-30)
Returns:
- jdn: Julian Day Number
Example:
HebrewToJDN(5785, 1, 1) = 2460587 // 1 Tishrei 5785 (Rosh Hashanah) HebrewToJDN(5785, 8, 15) = 2460779 // 15 Nisan 5785 (Passover)
func IsFrenchLeapYear ¶ added in v0.4.0
IsFrenchLeapYear returns true if the French Republican year is a leap year. Uses the "continuous" method: leap if following Gregorian year is divisible by 4, except centuries unless also divisible by 400.
The French Republican calendar was historically based on astronomical observations, but for computational purposes we use the Gregorian-aligned rule based on the epoch. A French Republican year N spans from September 22 of Gregorian year (1791+N) to September 21 of Gregorian year (1792+N). The year is a leap year (366 days) when the following Gregorian year (1792+N) is a leap year.
Parameters:
- year: French Republican year (1 = Sep 22, 1792 - Sep 21, 1793)
Returns:
- true if the year has 6 complementary days (366 days total)
Example:
IsFrenchLeapYear(4) = true // Year 4 (Sep 22, 1795 - Sep 21, 1796), Gregorian 1796 is leap IsFrenchLeapYear(12) = true // Year 12 (Sep 22, 1803 - Sep 21, 1804), Gregorian 1804 is leap IsFrenchLeapYear(16) = true // Year 16 (Sep 22, 1807 - Sep 21, 1808), Gregorian 1808 is leap
func IsHebrewLeapYear ¶ added in v0.4.0
IsHebrewLeapYear returns true if the Hebrew year has 13 months. Leap years occur in years 3, 6, 8, 11, 14, 17, 19 of each 19-year cycle.
The Hebrew calendar uses a 19-year Metonic cycle where 7 out of every 19 years are leap years with an additional month (Adar II). The pattern ensures that the lunar calendar stays synchronized with the solar year.
Parameters:
- year: Hebrew year
Returns:
- true if the year has 13 months (leap year)
Example:
IsHebrewLeapYear(5784) = true // Year 5784 is a leap year IsHebrewLeapYear(5785) = false // Year 5785 is not a leap year
func JDNToFrench ¶ added in v0.4.0
JDNToFrench converts a Julian Day Number to French Republican calendar date. Returns month=13 for complementary days.
The French Republican calendar was used in France from 1792-1805. It has:
- 12 months of exactly 30 days each
- 5 complementary days (6 in leap years) at the end of the year
- Epoch: 1 Vendémiaire 1 = September 22, 1792 (Gregorian) = JDN 2375840
Parameters:
- jdn: Julian Day Number
Returns:
- year: French Republican year (1 = 1792-1793)
- month: 1-13 (1-12 are regular months, 13 = complementary days)
- day: 1-30 for months 1-12, 1-5 (or 1-6 in leap years) for month 13
Example:
JDNToFrench(2375840) = (1, 1, 1) // 1 Vendémiaire 1 JDNToFrench(2378396) = (8, 1, 1) // 1 Vendémiaire 8 JDNToFrench(2380587) = (14, 1, 1) // 1 Vendémiaire 14
func JDNToGregorian ¶ added in v0.4.0
JDNToGregorian converts a Julian Day Number to Gregorian date. Returns year in astronomical numbering (0 = 1 BC, -1 = 2 BC, etc.)
Reference: Dershowitz & Reingold "Calendrical Calculations"
Parameters:
- jdn: Julian Day Number
Returns:
- year: astronomical year (0 = 1 BC, -1 = 2 BC, etc.)
- month: 1-12 (January = 1, December = 12)
- day: 1-31 depending on month
Example:
JDNToGregorian(2451545) = (2000, 1, 1) // January 1, 2000
func JDNToHebrew ¶ added in v0.4.0
JDNToHebrew converts a Julian Day Number to Hebrew calendar date. Returns month in GEDCOM numbering (Tishrei=1).
The Hebrew calendar is a lunisolar calendar with years of 12 or 13 months. The epoch is Tishrei 1, 1 = Monday, September 7, 3761 BC (Julian) = JDN 347998.
Parameters:
- jdn: Julian Day Number
Returns:
- year: Hebrew year
- month: Month number (1-13, Tishrei=1 per GEDCOM convention)
- day: Day of month (1-30)
Example:
JDNToHebrew(2460587) = (5785, 1, 1) // 1 Tishrei 5785 (Rosh Hashanah) JDNToHebrew(2460779) = (5785, 8, 15) // 15 Nisan 5785 (Passover)
func JDNToJulian ¶ added in v0.4.0
JDNToJulian converts a Julian Day Number to Julian calendar date. Returns year in astronomical numbering (0 = 1 BC, -1 = 2 BC, etc.)
Reference: Dershowitz & Reingold "Calendrical Calculations"
Parameters:
- jdn: Julian Day Number
Returns:
- year: astronomical year (0 = 1 BC, -1 = 2 BC, etc.)
- month: 1-12 (January = 1, December = 12)
- day: 1-31 depending on month
Example:
JDNToJulian(2299160) = (1582, 10, 4) // Oct 4, 1582 (last Julian day) JDNToJulian(1705426) = (-43, 3, 15) // Ides of March, 44 BC
func JulianToJDN ¶ added in v0.4.0
JulianToJDN converts a Julian calendar date to Julian Day Number. Uses astronomical year numbering (year 0 exists, negative years for BC).
The Julian calendar was introduced by Julius Caesar in 45 BC and differs from the Gregorian calendar only in leap year rules:
- Julian: leap year every 4 years (no century exception)
- Gregorian: leap year every 4 years, except centuries unless divisible by 400
Most countries switched from Julian to Gregorian in October 1582, though some regions continued using the Julian calendar until the 20th century. Historical dates before October 15, 1582 are typically expressed in Julian calendar.
Reference: Dershowitz & Reingold "Calendrical Calculations"
Parameters:
- year: astronomical year (0 = 1 BC, -1 = 2 BC, etc.)
- month: 1-12 (January = 1, December = 12)
- day: 1-31 depending on month
Returns:
- jdn: Julian Day Number
Example:
JulianToJDN(1582, 10, 4) = 2299160 // Oct 4, 1582 (last Julian day in most countries) JulianToJDN(-43, 3, 15) = 1705426 // Ides of March, 44 BC JulianToJDN(1, 1, 1) = 1721424 // January 1, 1 AD
func ValidateBirthBeforeDeath ¶ added in v0.4.0
ValidateBirthBeforeDeath checks if a birth date is before or equal to a death date. Returns nil if the birth date is before or equal to the death date, or if either date is nil. Returns an error with descriptive message if the death date is before the birth date.
func ValidateMarriageDates ¶ added in v0.4.0
ValidateMarriageDates validates that both spouses were at least minMarriageAge years old at the time of marriage. Returns nil if there is insufficient date data to validate. Returns an error if either spouse would have been too young at the marriage date.
The minMarriageAge parameter specifies the minimum age for marriage. A typical value is 12 years (historical minimum in some cultures).
func ValidateParentChildDates ¶ added in v0.4.0
ValidateParentChildDates validates that a parent was at least minParentAge years old when a child was born. Returns nil if either date is nil, or if the parent meets the minimum age requirement. Returns an error if the parent would have been too young.
The minParentAge parameter specifies the minimum biological age for parenthood. A typical value is 12 years (biological minimum).
func YearsBetween ¶ added in v0.4.0
YearsBetween calculates the number of years between two dates. For complete Gregorian dates, uses exact calculation via time.Time. For partial dates or non-Gregorian calendars, uses simple year subtraction. Returns error if both dates don't have years (insufficient data). Always returns absolute value (no negative years).
Example ¶
ExampleYearsBetween demonstrates calculating age from dates.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
birth, _ := gedcom.ParseDate("15 MAR 1920")
death, _ := gedcom.ParseDate("20 JUN 1985")
years, exact, err := gedcom.YearsBetween(birth, death)
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Years: %d, Exact calculation: %v\n", years, exact)
}
Output: Years: 65, Exact calculation: true
Types ¶
type Address ¶
type Address struct {
// Line1 is the first address line
Line1 string
// Line2 is the second address line (optional)
Line2 string
// Line3 is the third address line (optional)
Line3 string
// City is the city name
City string
// State is the state/province
State string
// PostalCode is the postal/zip code
PostalCode string
// Country is the country name
Country string
// Phone is the phone number (optional)
Phone string
// Email is the email address (optional)
Email string
// Website is the website URL (optional)
Website string
}
Address represents a physical or digital address.
type AncestryAPID ¶ added in v0.6.0
type AncestryAPID struct {
// Raw is the original unparsed APID value
Raw string
// Database is the Ancestry database ID
Database string
// Record is the record ID within the database
Record string
}
AncestryAPID represents an Ancestry Permanent Identifier from the _APID tag. This is a vendor-specific extension used by Ancestry.com to link GEDCOM data to their online databases.
The APID format is typically "1,DATABASE::RECORD" where:
- The "1," prefix is a version/type indicator (usually ignored)
- DATABASE is the Ancestry database ID
- RECORD is the record ID within that database
Example: "1,7602::2771226" where 7602 is the database and 2771226 is the record.
func ParseAPID ¶ added in v0.6.0
func ParseAPID(value string) *AncestryAPID
ParseAPID parses an Ancestry APID string into an AncestryAPID struct. Returns nil if the value cannot be parsed.
Supported formats:
- "1,DATABASE::RECORD" (standard format with prefix)
- "DATABASE::RECORD" (without prefix)
Examples:
ParseAPID("1,7602::2771226") -> &AncestryAPID{Raw: "1,7602::2771226", Database: "7602", Record: "2771226"}
ParseAPID("7602::2771226") -> &AncestryAPID{Raw: "7602::2771226", Database: "7602", Record: "2771226"}
ParseAPID("invalid") -> nil
func (*AncestryAPID) URL ¶ added in v0.6.0
func (a *AncestryAPID) URL() string
URL returns the Ancestry.com URL for this record. The URL format is: https://www.ancestry.com/discoveryui-content/view/{record}:{database}
type Association ¶ added in v0.3.0
type Association struct {
// IndividualXRef is the cross-reference to the associated individual
IndividualXRef string
// Role is the relationship role (e.g., "GODP" for godparent, "WITN" for witness)
// In GEDCOM 5.5.1 this comes from RELA tag, in GEDCOM 7.0 from ROLE tag
Role string
// Phrase is a human-readable description of the association (GEDCOM 7.0 PHRASE tag).
// Used when the structured data cannot fully express the relationship.
// Example: "Mr Stockdale" as the associated person's name when @XREF@ is unavailable.
Phrase string
// SourceCitations are source citations documenting this association (GEDCOM 7.0).
// Allows citing sources for the association relationship itself.
SourceCitations []*SourceCitation
// Notes are note references for this association
Notes []string
}
Association represents a link to an associated individual with a role. Used for relationships like godparents (GODP), witnesses (WITN), etc.
type Attribute ¶
type Attribute struct {
// Type is the attribute type (e.g., "OCCU" for occupation, "EDUC" for education)
Type string
// Value is the attribute value
Value string
// Date when the attribute was applicable (optional)
Date string
// ParsedDate is the parsed representation of Date.
// This is nil if the date string could not be parsed.
ParsedDate *Date
// Place where the attribute was applicable (optional)
Place string
// SourceCitations are source citations with page/quality details
SourceCitations []*SourceCitation
}
Attribute represents a personal attribute.
type Calendar ¶ added in v0.4.0
type Calendar int
Calendar represents the calendar system used for a date.
type ChangeDate ¶ added in v0.3.0
type ChangeDate struct {
// Date is the date of the change (in GEDCOM date format)
Date string
// Time is the time of the change (in HH:MM:SS format)
Time string
}
ChangeDate represents when a record was created or last modified. Used by CHAN (change date) and CREA (creation date) tags.
type ConversionNote ¶ added in v1.2.0
type ConversionNote struct {
// Path identifies the location in the GEDCOM document using a hierarchical format.
// Examples:
// - "Individual @I1@" (record level)
// - "Individual @I1@ > Birth > Date" (nested element)
// - "Header > CHAR" (header element)
Path string
// Original is the value before transformation.
// May be empty for newly generated elements.
Original string
// Result is the value after transformation.
// May be empty for dropped elements.
Result string
// Reason explains why the transformation occurred.
Reason string
}
ConversionNote records a single per-item change during GEDCOM version conversion. It provides granular tracking of what changed, including the path to the affected element and the before/after values.
type ConversionReport ¶ added in v0.8.0
type ConversionReport struct {
// SourceVersion is the original GEDCOM version before conversion
SourceVersion Version
// TargetVersion is the GEDCOM version after conversion
TargetVersion Version
// Transformations lists all changes made during conversion
Transformations []Transformation
// DataLoss lists features that were lost during conversion (typically downgrades)
DataLoss []DataLossItem
// ValidationIssues lists any problems found after conversion
ValidationIssues []string
// Success indicates whether the conversion completed successfully
Success bool
// Dropped contains notes for data that couldn't be represented in the target version.
// These represent actual information loss during conversion.
Dropped []ConversionNote
// Normalized contains notes for formatting or structural changes.
// The semantic meaning is preserved, but the representation changed.
Normalized []ConversionNote
// Approximated contains notes for semantic equivalents that aren't exact.
// The meaning is similar but not identical after conversion.
Approximated []ConversionNote
// Preserved contains notes for unknown tags kept through conversion.
// These elements passed through unchanged despite being non-standard.
Preserved []ConversionNote
}
ConversionReport contains the results of a GEDCOM version conversion. It tracks all transformations applied, any data loss that occurred, and validation issues found after conversion.
func (*ConversionReport) AddApproximated ¶ added in v1.2.0
func (r *ConversionReport) AddApproximated(note ConversionNote)
AddApproximated adds a note for a semantic equivalent that isn't exact.
func (*ConversionReport) AddDataLoss ¶ added in v0.8.0
func (r *ConversionReport) AddDataLoss(d DataLossItem)
AddDataLoss adds a data loss record to the report.
func (*ConversionReport) AddDropped ¶ added in v1.2.0
func (r *ConversionReport) AddDropped(note ConversionNote)
AddDropped adds a note for data that couldn't be represented in the target version.
func (*ConversionReport) AddNormalized ¶ added in v1.2.0
func (r *ConversionReport) AddNormalized(note ConversionNote)
AddNormalized adds a note for a formatting or structural change.
func (*ConversionReport) AddPreserved ¶ added in v1.2.0
func (r *ConversionReport) AddPreserved(note ConversionNote)
AddPreserved adds a note for an unknown tag kept through conversion.
func (*ConversionReport) AddTransformation ¶ added in v0.8.0
func (r *ConversionReport) AddTransformation(t Transformation)
AddTransformation adds a transformation record to the report.
func (*ConversionReport) AllNotes ¶ added in v1.2.0
func (r *ConversionReport) AllNotes() []ConversionNote
AllNotes returns all conversion notes across all categories. Notes are returned in the order: Dropped, Normalized, Approximated, Preserved.
func (*ConversionReport) HasDataLoss ¶ added in v0.8.0
func (r *ConversionReport) HasDataLoss() bool
HasDataLoss returns true if any data was lost during conversion.
func (*ConversionReport) String ¶ added in v0.8.0
func (r *ConversionReport) String() string
String returns a human-readable summary of the conversion report.
type Coordinates ¶ added in v0.3.0
type Coordinates struct {
// Latitude in GEDCOM format (e.g., "N42.3601")
Latitude string
// Longitude in GEDCOM format (e.g., "W71.0589")
Longitude string
}
Coordinates represents geographic coordinates for a place.
type CropRegion ¶ added in v0.3.0
type CropRegion struct {
// Height is the region height in pixels (default: image height - Top)
Height int
// Left is the horizontal position of top-left corner (default 0)
Left int
// Top is the vertical position of top-left corner (default 0)
Top int
// Width is the region width in pixels (default: image width - Left)
Width int
}
CropRegion defines a subregion of an image to display (GEDCOM 7.0 CROP). Used to specify which portion of an image should be displayed when referenced.
type DataLossItem ¶ added in v0.8.0
type DataLossItem struct {
// Feature is the name of the lost feature (e.g., "SCHMA tag", "EXID external IDs")
Feature string
// Reason explains why the feature was lost (e.g., "Not supported in GEDCOM 5.5.1")
Reason string
// AffectedRecords lists the XRefs of records that were affected
AffectedRecords []string
}
DataLossItem records a feature that was lost during conversion. This typically occurs when downgrading from a newer GEDCOM version to an older one that doesn't support certain features.
type Date ¶ added in v0.4.0
type Date struct {
// Original is the raw GEDCOM date string (preserved for round-trip)
Original string
// Day is the day of the month (0 if unknown, 1-31)
Day int
// Month is the month (0 if unknown, 1-12)
Month int
// Year is the year (0 if unknown)
Year int
// Modifier indicates the type of date (exact, approximate, range, etc.)
Modifier DateModifier
// EndDate is populated for ranges (BET...AND) and periods (FROM...TO)
EndDate *Date
// Calendar indicates the calendar system (Gregorian, Julian, Hebrew, French Republican)
Calendar Calendar
// IsBC is true for B.C./BCE dates
IsBC bool
// DualYear is the second year for dual dating (e.g., 1751 from "1750/51")
DualYear int
// Phrase contains the text for date phrases (e.g., "unknown" from "(unknown)")
Phrase string
// IsPhrase is true when the date is a phrase, not a parseable date
IsPhrase bool
// IsInterpreted is true when the date uses the INT modifier, indicating
// the user has interpreted an ambiguous original phrase
IsInterpreted bool
// InterpretedFrom contains the original phrase that was interpreted,
// without the surrounding parentheses (e.g., "about eighteen fifty" from
// "INT 1850 (about eighteen fifty)")
InterpretedFrom string
}
Date represents a parsed GEDCOM date with support for multiple calendar systems, modifiers, and date ranges/periods.
func ParseDate ¶ added in v0.4.0
ParseDate parses a GEDCOM date string into a Date struct. Supports exact dates, partial dates, modifiers, ranges, periods, dual dating, B.C. dates, and date phrases.
Examples:
- "25 DEC 2020" -> exact date
- "JAN 1900" -> partial date (month and year)
- "1850" -> partial date (year only)
- "ABT 1850" -> approximate date
- "BET 1850 AND 1860" -> date range
- "FROM 1880 TO 1920" -> date period
- "21 FEB 1750/51" -> dual dating
- "44 BC" -> B.C. date
- "(unknown)" -> date phrase
Example ¶
ExampleParseDate demonstrates parsing various date formats.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
// Exact date
date1, _ := gedcom.ParseDate("25 DEC 2020")
fmt.Printf("Day: %d, Month: %d, Year: %d\n", date1.Day, date1.Month, date1.Year)
// Partial date (year only)
date2, _ := gedcom.ParseDate("1850")
fmt.Printf("Year only: %d\n", date2.Year)
// Approximate date
date3, _ := gedcom.ParseDate("ABT 1920")
fmt.Printf("Approximate year: %d, Modifier: %s\n", date3.Year, date3.Modifier)
}
Output: Day: 25, Month: 12, Year: 2020 Year only: 1850 Approximate year: 1920, Modifier: ABT
Example (Ranges) ¶
ExampleParseDate_ranges shows parsing date ranges and periods.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
// Date range (BET...AND)
rangeDate, _ := gedcom.ParseDate("BET 1850 AND 1860")
fmt.Printf("Between: %d and %d\n", rangeDate.Year, rangeDate.EndDate.Year)
// Date period (FROM...TO)
periodDate, _ := gedcom.ParseDate("FROM 1880 TO 1920")
fmt.Printf("From: %d to %d\n", periodDate.Year, periodDate.EndDate.Year)
// Before date
beforeDate, _ := gedcom.ParseDate("BEF 1900")
fmt.Printf("Before: %d, Modifier: %s\n", beforeDate.Year, beforeDate.Modifier)
}
Output: Between: 1850 and 1860 From: 1880 to 1920 Before: 1900, Modifier: BEF
func (*Date) Compare ¶ added in v0.4.0
Compare compares two dates and returns -1 if d < other, 0 if d == other, 1 if d > other. For partial dates, missing components are treated as the earliest possible value (day=1, month=1). B.C. dates sort before all A.D. dates, and among B.C. dates, higher year numbers are earlier (100 BC < 200 BC).
When comparing dates with different calendars, both dates are converted to JDN (Julian Day Number) for accurate cross-calendar comparison.
Example ¶
ExampleDate_Compare demonstrates date comparison.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
earlier, _ := gedcom.ParseDate("15 MAR 1920")
later, _ := gedcom.ParseDate("20 JUN 1985")
result := earlier.Compare(later)
if result < 0 {
fmt.Println("1920 is before 1985")
}
// Use convenience methods
fmt.Printf("IsBefore: %v\n", earlier.IsBefore(later))
fmt.Printf("IsAfter: %v\n", earlier.IsAfter(later))
}
Output: 1920 is before 1985 IsBefore: true IsAfter: false
func (*Date) IsAfter ¶ added in v0.4.0
IsAfter returns true if d is after other. Returns false if either date is nil.
func (*Date) IsBefore ¶ added in v0.4.0
IsBefore returns true if d is before other. Returns false if either date is nil.
func (*Date) IsEqual ¶ added in v0.4.0
IsEqual returns true if d is equal to other. Returns true if both dates are nil, false if only one is nil.
func (*Date) ToGregorian ¶ added in v0.4.0
ToGregorian converts the date to the Gregorian calendar. Returns a new Date with Calendar set to CalendarGregorian.
For dates already in Gregorian calendar, returns a copy of self. For partial dates (missing day or month), converts available components. Returns error if year is 0 (date too incomplete to convert).
The Original field is preserved from the source date.
func (*Date) ToTime ¶ added in v0.4.0
ToTime converts the date to a time.Time value. Returns an error if the date is incomplete (missing day, month, or year) or if the calendar is not Gregorian.
Example ¶
ExampleDate_ToTime shows converting a date to time.Time.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
date, _ := gedcom.ParseDate("4 JUL 1776")
t, err := date.ToTime()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Year: %d, Month: %s, Day: %d\n", t.Year(), t.Month(), t.Day())
}
Output: Year: 1776, Month: July, Day: 4
func (*Date) Validate ¶ added in v0.4.0
Validate checks if the date is semantically valid (e.g., no day overflow like Feb 30). Returns nil for partial dates (day, month, or year is 0) or non-Gregorian calendars. Uses stdlib time.Date() to detect invalid dates via normalization.
Example ¶
ExampleDate_Validate shows date validation.
package main
import (
"fmt"
"github.com/cacack/gedcom-go/gedcom"
)
func main() {
// Valid date
validDate, _ := gedcom.ParseDate("28 FEB 2020")
if err := validDate.Validate(); err == nil {
fmt.Println("Feb 28, 2020 is valid")
}
// Invalid date (Feb 30 doesn't exist)
invalidDate := &gedcom.Date{Day: 30, Month: 2, Year: 2020}
if err := invalidDate.Validate(); err != nil {
fmt.Println("Feb 30 is invalid")
}
}
Output: Feb 28, 2020 is valid Feb 30 is invalid
type DateModifier ¶ added in v0.4.0
type DateModifier int
DateModifier represents modifiers for date precision and ranges.
const ( // ModifierNone indicates an exact date with no modifier ModifierNone DateModifier = iota // ModifierAbout indicates an approximate date (ABT) ModifierAbout // ModifierCalculated indicates a calculated date (CAL) ModifierCalculated // ModifierEstimated indicates an estimated date (EST) ModifierEstimated // ModifierBefore indicates a date before the specified date (BEF) ModifierBefore // ModifierAfter indicates a date after the specified date (AFT) ModifierAfter // ModifierBetween indicates a date range (BET...AND) ModifierBetween // ModifierFrom indicates a period starting from a date (FROM) ModifierFrom // ModifierTo indicates a period ending at a date (TO) ModifierTo // ModifierFromTo indicates a period with start and end dates (FROM...TO) ModifierFromTo // ModifierInterpreted indicates an interpreted date where the user has clarified // an ambiguous original phrase (INT). The original phrase is stored in InterpretedFrom. ModifierInterpreted )
func (DateModifier) String ¶ added in v0.4.0
func (m DateModifier) String() string
String returns the string representation of the date modifier.
type Document ¶
type Document struct {
// Header contains file metadata
Header *Header
// Records contains all top-level records (individuals, families, sources, etc.)
Records []*Record
// Trailer marks the end of the file
Trailer *Trailer
// XRefMap provides fast lookup of records by cross-reference ID
// Map key is the XRef (e.g., "@I1@"), value is the Record
XRefMap map[string]*Record
// Vendor identifies the software that created this GEDCOM file.
// Detected from the HEAD.SOUR tag during decoding.
Vendor Vendor
// Schema contains GEDCOM 7.0 schema definitions that map custom tags to URIs.
// Extracted from the HEAD.SCHMA structure during decoding.
Schema *SchemaDefinition
}
Document represents a complete GEDCOM file with all its records.
Example ¶
ExampleDocument demonstrates accessing records in a GEDCOM document.
package main
import (
"fmt"
"strings"
"github.com/cacack/gedcom-go/decoder"
)
func main() {
gedcomData := `0 HEAD
1 GEDC
2 VERS 5.5
0 @I1@ INDI
1 NAME John /Smith/
1 SEX M
0 @I2@ INDI
1 NAME Jane /Doe/
1 SEX F
0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
0 TRLR`
doc, _ := decoder.Decode(strings.NewReader(gedcomData))
// Access all individuals
fmt.Printf("Individuals: %d\n", len(doc.Individuals()))
// Access all families
fmt.Printf("Families: %d\n", len(doc.Families()))
}
Output: Individuals: 2 Families: 1
Example (Traversal) ¶
ExampleDocument_traversal shows how to traverse family relationships.
package main
import (
"fmt"
"strings"
"github.com/cacack/gedcom-go/decoder"
)
func main() {
gedcomData := `0 HEAD
1 GEDC
2 VERS 5.5
0 @I1@ INDI
1 NAME John /Smith/
0 @I2@ INDI
1 NAME Jane /Smith/
0 @I3@ INDI
1 NAME Jimmy /Smith/
0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
1 CHIL @I3@
0 TRLR`
doc, _ := decoder.Decode(strings.NewReader(gedcomData))
// Get a family and resolve its members
family := doc.GetFamily("@F1@")
if family != nil {
husband := doc.GetIndividual(family.Husband)
wife := doc.GetIndividual(family.Wife)
if husband != nil && len(husband.Names) > 0 {
fmt.Printf("Husband: %s\n", husband.Names[0].Full)
}
if wife != nil && len(wife.Names) > 0 {
fmt.Printf("Wife: %s\n", wife.Names[0].Full)
}
// List children
for _, childXRef := range family.Children {
child := doc.GetIndividual(childXRef)
if child != nil && len(child.Names) > 0 {
fmt.Printf("Child: %s\n", child.Names[0].Full)
}
}
}
}
Output: Husband: John /Smith/ Wife: Jane /Smith/ Child: Jimmy /Smith/
func (*Document) GetFamily ¶
GetFamily returns the family record with the given XRef. Returns nil if not found or if the record is not a family.
Example ¶
ExampleDocument_GetFamily shows XRef-based family lookup.
package main
import (
"fmt"
"strings"
"github.com/cacack/gedcom-go/decoder"
)
func main() {
gedcomData := `0 HEAD
1 GEDC
2 VERS 5.5
0 @I1@ INDI
1 NAME John /Smith/
0 @I2@ INDI
1 NAME Jane /Smith/
0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
0 TRLR`
doc, _ := decoder.Decode(strings.NewReader(gedcomData))
// Lookup family
family := doc.GetFamily("@F1@")
if family != nil {
fmt.Printf("Husband XRef: %s\n", family.Husband)
fmt.Printf("Wife XRef: %s\n", family.Wife)
}
}
Output: Husband XRef: @I1@ Wife XRef: @I2@
func (*Document) GetIndividual ¶
func (d *Document) GetIndividual(xref string) *Individual
GetIndividual returns the individual record with the given XRef. Returns nil if not found or if the record is not an individual.
Example ¶
ExampleDocument_GetIndividual shows XRef-based individual lookup.
package main
import (
"fmt"
"strings"
"github.com/cacack/gedcom-go/decoder"
)
func main() {
gedcomData := `0 HEAD
1 GEDC
2 VERS 5.5
0 @I1@ INDI
1 NAME Alice /Johnson/
1 SEX F
0 @I2@ INDI
1 NAME Bob /Johnson/
1 SEX M
0 TRLR`
doc, _ := decoder.Decode(strings.NewReader(gedcomData))
// Lookup by XRef
alice := doc.GetIndividual("@I1@")
if alice != nil && len(alice.Names) > 0 {
fmt.Printf("Found: %s\n", alice.Names[0].Full)
}
// Non-existent XRef returns nil
unknown := doc.GetIndividual("@I999@")
fmt.Printf("Unknown is nil: %v\n", unknown == nil)
}
Output: Found: Alice /Johnson/ Unknown is nil: true
func (*Document) GetMediaObject ¶ added in v0.3.0
func (d *Document) GetMediaObject(xref string) *MediaObject
GetMediaObject returns the media object with the given XRef. Returns nil if not found or if the record is not a media object.
func (*Document) GetNote ¶ added in v0.3.0
GetNote returns the note record with the given XRef. Returns nil if not found or if the record is not a note.
func (*Document) GetRecord ¶
GetRecord returns the record with the given cross-reference ID. Returns nil if the record is not found.
func (*Document) GetRepository ¶ added in v0.3.0
func (d *Document) GetRepository(xref string) *Repository
GetRepository returns the repository record with the given XRef. Returns nil if not found or if the record is not a repository.
func (*Document) GetSharedNote ¶ added in v1.1.0
func (d *Document) GetSharedNote(xref string) *SharedNote
GetSharedNote returns the shared note record with the given XRef. Returns nil if not found or if the record is not a shared note.
func (*Document) GetSource ¶
GetSource returns the source record with the given XRef. Returns nil if not found or if the record is not a source.
func (*Document) GetSubmitter ¶ added in v0.3.0
GetSubmitter returns the submitter record with the given XRef. Returns nil if not found or if the record is not a submitter.
func (*Document) Individuals ¶
func (d *Document) Individuals() []*Individual
Individuals returns all individual records in the document.
func (*Document) MediaObjects ¶ added in v0.3.0
func (d *Document) MediaObjects() []*MediaObject
MediaObjects returns all media object records in the document.
func (*Document) Repositories ¶ added in v0.3.0
func (d *Document) Repositories() []*Repository
Repositories returns all repository records in the document.
func (*Document) SharedNotes ¶ added in v1.1.0
func (d *Document) SharedNotes() []*SharedNote
SharedNotes returns all shared note records in the document (GEDCOM 7.0).
func (*Document) Submitters ¶ added in v0.3.0
Submitters returns all submitter records in the document.
type Encoding ¶
type Encoding string
Encoding represents character encoding used in a GEDCOM file.
const ( // EncodingUTF8 represents UTF-8 character encoding EncodingUTF8 Encoding = "UTF-8" // EncodingANSEL represents ANSEL (ANSI Z39.47) character encoding (GEDCOM 5.5 default) EncodingANSEL Encoding = "ANSEL" // EncodingASCII represents ASCII character encoding EncodingASCII Encoding = "ASCII" // EncodingLATIN1 represents Latin-1 (ISO-8859-1) character encoding EncodingLATIN1 Encoding = "LATIN1" // EncodingUNICODE is an alias for UTF-8 used in some GEDCOM files EncodingUNICODE Encoding = "UNICODE" )
type Event ¶
type Event struct {
// Type is the event type (birth, death, marriage, etc.)
Type EventType
// Date is when the event occurred (in GEDCOM date format)
Date string
// ParsedDate is the parsed representation of Date.
// This is nil if the date string could not be parsed.
ParsedDate *Date
// Place is where the event occurred (kept for backward compatibility)
Place string
// PlaceDetail provides structured place information with optional coordinates
PlaceDetail *PlaceDetail
// Description provides additional details
Description string
// EventTypeDetail provides a descriptive type of the event (TYPE subordinate)
EventTypeDetail string
// Cause is the cause of the event (CAUS subordinate)
Cause string
// Age is the age at the time of the event (AGE subordinate)
Age string
// Agency is the responsible agency (AGNC subordinate)
Agency string
// Address is the event address structure (ADDR subordinate)
Address *Address
// Phone numbers associated with the event (PHON subordinate, can repeat)
Phone []string
// Email addresses associated with the event (EMAIL subordinate, can repeat)
Email []string
// Fax numbers associated with the event (FAX subordinate, can repeat)
Fax []string
// Websites associated with the event (WWW subordinate, can repeat)
Website []string
// Restriction notice for privacy controls (RESN subordinate)
// Common values: "confidential", "locked", "privacy" (or combinations)
Restriction string
// UID is a unique identifier for the event (UID subordinate)
UID string
// SortDate is the date used for sorting events (SDATE subordinate, GEDCOM 7.0)
// Typically in ISO 8601 format (e.g., "1900-01-01")
SortDate string
// IsNegative indicates this is a GEDCOM 7.0 negative assertion.
// When true, it means the event did NOT occur (e.g., NO MARR = never married).
// The NO tag is used to record explicit conclusions from research that an event
// did not happen, which is different from simply having no information.
IsNegative bool
// SourceCitations are source citations with page/quality details
SourceCitations []*SourceCitation
// Notes are references to note records
Notes []string
// Media are references to media objects with optional crop/title
Media []*MediaLink
// Tags contains all raw tags for this event (for unknown/custom fields)
Tags []*Tag
}
Event represents a life event with date, place, and source information.
type EventType ¶
type EventType string
EventType represents the type of life event.
const ( // EventBirth represents a birth event. EventBirth EventType = "BIRT" // EventDeath represents a death event. EventDeath EventType = "DEAT" // EventBaptism represents a baptism event. EventBaptism EventType = "BAPM" // EventBurial represents a burial event. EventBurial EventType = "BURI" // EventCensus represents a census event. EventCensus EventType = "CENS" // EventChristening represents a christening event. EventChristening EventType = "CHR" // EventAdoption represents an adoption event. EventAdoption EventType = "ADOP" // EventOccupation represents an occupation event. EventOccupation EventType = "OCCU" // EventResidence represents a residence event. EventResidence EventType = "RESI" // EventImmigration represents an immigration event. EventImmigration EventType = "IMMI" // EventEmigration represents an emigration event. EventEmigration EventType = "EMIG" // EventBarMitzvah represents a Bar Mitzvah event. EventBarMitzvah EventType = "BARM" // EventBasMitzvah represents a Bas Mitzvah (also Bat Mitzvah) event. EventBasMitzvah EventType = "BASM" // EventBlessing represents a blessing event. EventBlessing EventType = "BLES" // EventAdultChristening represents an adult christening event. EventAdultChristening EventType = "CHRA" // EventConfirmation represents a confirmation event. EventConfirmation EventType = "CONF" // EventFirstCommunion represents a first communion event. EventFirstCommunion EventType = "FCOM" // EventGraduation represents a graduation event. EventGraduation EventType = "GRAD" // EventRetirement represents a retirement event. EventRetirement EventType = "RETI" // EventNaturalization represents a naturalization event. EventNaturalization EventType = "NATU" // EventOrdination represents an ordination event. EventOrdination EventType = "ORDN" // EventProbate represents a probate event. EventProbate EventType = "PROB" // EventWill represents a will event. EventWill EventType = "WILL" // EventCremation represents a cremation event. EventCremation EventType = "CREM" // EventMarriage represents a marriage event. EventMarriage EventType = "MARR" // EventDivorce represents a divorce event. EventDivorce EventType = "DIV" // EventEngagement represents an engagement event. EventEngagement EventType = "ENGA" // EventAnnulment represents an annulment event. EventAnnulment EventType = "ANUL" // EventMarriageBann represents a marriage bann event. EventMarriageBann EventType = "MARB" // EventMarriageContract represents a marriage contract event. EventMarriageContract EventType = "MARC" // EventMarriageLicense represents a marriage license event. EventMarriageLicense EventType = "MARL" // EventMarriageSettlement represents a marriage settlement event. EventMarriageSettlement EventType = "MARS" // EventDivorceFiling represents a divorce filing event. EventDivorceFiling EventType = "DIVF" )
type ExternalID ¶ added in v1.1.0
type ExternalID struct {
// Value is the external identifier string
Value string
// Type is the URI identifying the external system (from TYPE subordinate)
Type string
}
ExternalID represents an external identifier (GEDCOM 7.0 EXID tag). Links a record to an external system like FamilySearch, Ancestry, etc.
GEDCOM 7.0 structure:
n EXID <Text> +1 TYPE <URI>
Example:
1 EXID 9876543210 2 TYPE http://www.familysearch.org/ark
type Family ¶
type Family struct {
// XRef is the cross-reference identifier for this family
XRef string
// Husband is the XRef to the husband individual
Husband string
// Wife is the XRef to the wife individual
Wife string
// Children are XRefs to child individuals
Children []string
// NumberOfChildren is the declared number of children (NCHI tag)
NumberOfChildren string
// Events contains family events (marriage, divorce, etc.)
Events []*Event
// SourceCitations are source citations with page/quality details
SourceCitations []*SourceCitation
// Notes are references to note records
Notes []string
// Media are references to media objects with optional crop/title
Media []*MediaLink
// LDSOrdinances are LDS (Latter-Day Saints) ordinances (SLGS - spouse sealing)
LDSOrdinances []*LDSOrdinance
// ChangeDate is when the record was last modified (CHAN tag)
ChangeDate *ChangeDate
// CreationDate is when the record was created (CREA tag, GEDCOM 7.0)
CreationDate *ChangeDate
// RefNumber is the user reference number (REFN tag)
RefNumber string
// UID is the unique identifier (UID tag)
UID string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// Tags contains all raw tags for this family (for unknown/custom tags)
Tags []*Tag
}
Family represents a family unit (husband, wife, and children).
func (*Family) AllMembers ¶ added in v0.7.0
func (f *Family) AllMembers(doc *Document) []*Individual
AllMembers returns all Individual records for this family (husband, wife, children). Order: husband first (if present), wife second (if present), then children. Invalid xrefs are filtered out. Returns an empty slice if the document is nil or no members are found.
func (*Family) ChildrenIndividuals ¶ added in v0.7.0
func (f *Family) ChildrenIndividuals(doc *Document) []*Individual
ChildrenIndividuals returns Individual records for all children in this family. Invalid xrefs are filtered out. Order is preserved from the GEDCOM file. Returns an empty slice if the document is nil or there are no children.
func (*Family) HusbandIndividual ¶ added in v0.7.0
func (f *Family) HusbandIndividual(doc *Document) *Individual
HusbandIndividual returns the Individual record for the husband. Returns nil if the document is nil, Husband xref is empty, or the individual is not found.
func (*Family) WifeIndividual ¶ added in v0.7.0
func (f *Family) WifeIndividual(doc *Document) *Individual
WifeIndividual returns the Individual record for the wife. Returns nil if the document is nil, Wife xref is empty, or the individual is not found.
type FamilyLink ¶ added in v0.2.0
type FamilyLink struct {
// FamilyXRef is the cross-reference to the family record
FamilyXRef string
// Pedigree is the pedigree linkage type (e.g., "birth", "adopted", "foster", "sealing")
// Empty string if not specified. Preserves original casing from GEDCOM.
Pedigree string
}
FamilyLink represents a link to a family with optional pedigree type.
type Header ¶
type Header struct {
// Version is the GEDCOM specification version
Version Version
// Encoding is the character encoding used in the file
Encoding Encoding
// SourceSystem identifies the software that created the file
SourceSystem string
// Date is when the file was created
Date time.Time
// Language is the primary language used in the file (optional)
Language string
// Copyright notice (optional)
Copyright string
// Submitter reference (optional)
Submitter string
// AncestryTreeID is the Ancestry.com tree identifier from HEAD.SOUR._TREE.
// This is an Ancestry.com vendor extension that identifies the family tree
// this GEDCOM was exported from.
AncestryTreeID string
// Raw tags from the header for preserving unknown/custom tags
Tags []*Tag
}
Header contains metadata about the GEDCOM file.
type Individual ¶
type Individual struct {
// XRef is the cross-reference identifier for this individual
XRef string
// Names contains all name variants for this person
Names []*PersonalName
// Sex is the person's sex (M, F, X, U for unknown)
Sex string
// Events contains life events (birth, death, marriage, etc.)
Events []*Event
// Attributes contains personal attributes (occupation, education, etc.)
Attributes []*Attribute
// ChildInFamilies are references to families where this person is a child
ChildInFamilies []FamilyLink
// SpouseInFamilies are references to families where this person is a spouse
SpouseInFamilies []string // XRef to Family records
// Associations are links to associated individuals (godparents, witnesses, etc.)
Associations []*Association
// SourceCitations are source citations with page/quality details
SourceCitations []*SourceCitation
// Notes are references to note records
Notes []string // XRef to Note records
// Media are references to media objects with optional crop/title
Media []*MediaLink
// LDSOrdinances are LDS (Latter-Day Saints) ordinances (BAPL, CONL, ENDL, SLGC)
LDSOrdinances []*LDSOrdinance
// ChangeDate is when the record was last modified (CHAN tag)
ChangeDate *ChangeDate
// CreationDate is when the record was created (CREA tag, GEDCOM 7.0)
CreationDate *ChangeDate
// RefNumber is the user reference number (REFN tag)
RefNumber string
// UID is the unique identifier (UID tag)
UID string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// FamilySearchID is the FamilySearch Family Tree ID (_FSFTID tag).
// This is a vendor extension from FamilySearch.org that uniquely identifies
// an individual in their Family Tree database. Format: alphanumeric like "KWCJ-QN7".
FamilySearchID string
// Tags contains all raw tags for this individual (for unknown/custom tags)
Tags []*Tag
}
Individual represents a person in the GEDCOM file.
func (*Individual) BirthDate ¶ added in v0.4.0
func (i *Individual) BirthDate() *Date
BirthDate returns the parsed birth date for this individual, or nil if no birth event or no parsed date is available.
func (*Individual) BirthEvent ¶ added in v0.4.0
func (i *Individual) BirthEvent() *Event
BirthEvent returns the first birth event for this individual, or nil if none found.
func (*Individual) Children ¶ added in v0.7.0
func (i *Individual) Children(doc *Document) []*Individual
Children returns all children of this individual by looking up the families where this individual is a spouse and collecting all children from each family.
The doc parameter is required for O(1) cross-reference lookups. Returns an empty slice if doc is nil, no children are found, or if family/individual xrefs are invalid. Invalid xrefs are silently skipped. Order is preserved from the GEDCOM file.
func (*Individual) DeathDate ¶ added in v0.4.0
func (i *Individual) DeathDate() *Date
DeathDate returns the parsed death date for this individual, or nil if no death event or no parsed date is available.
func (*Individual) DeathEvent ¶ added in v0.4.0
func (i *Individual) DeathEvent() *Event
DeathEvent returns the first death event for this individual, or nil if none found.
func (*Individual) FamilySearchURL ¶ added in v0.6.0
func (i *Individual) FamilySearchURL() string
FamilySearchURL returns the FamilySearch.org URL for this individual's record. Returns an empty string if FamilySearchID is not set.
func (*Individual) ParentalFamilies ¶ added in v0.7.0
func (i *Individual) ParentalFamilies(doc *Document) []*Family
ParentalFamilies returns all families where this individual is a child. These are the family records containing this individual's parents.
The doc parameter is required for O(1) cross-reference lookups. Returns an empty slice if doc is nil, no parental families are found, or if family xrefs are invalid. Invalid xrefs are silently skipped. Order is preserved from the GEDCOM file.
func (*Individual) Parents ¶ added in v0.7.0
func (i *Individual) Parents(doc *Document) []*Individual
Parents returns all parents (biological) of this individual by looking up the families where this individual is a child and collecting the husband and wife from each family.
The doc parameter is required for O(1) cross-reference lookups. Returns an empty slice if doc is nil, no parents are found, or if family/individual xrefs are invalid. Invalid xrefs are silently skipped. Order is preserved from the GEDCOM file.
func (*Individual) SpouseFamilies ¶ added in v0.7.0
func (i *Individual) SpouseFamilies(doc *Document) []*Family
SpouseFamilies returns all families where this individual is a spouse. These are the family records where this individual is either the husband or wife.
The doc parameter is required for O(1) cross-reference lookups. Returns an empty slice if doc is nil, no spouse families are found, or if family xrefs are invalid. Invalid xrefs are silently skipped. Order is preserved from the GEDCOM file.
func (*Individual) Spouses ¶ added in v0.7.0
func (i *Individual) Spouses(doc *Document) []*Individual
Spouses returns all spouses of this individual by looking up the families where this individual is a spouse and returning the other spouse from each family.
The doc parameter is required for O(1) cross-reference lookups. Returns an empty slice if doc is nil, no spouses are found, or if family/individual xrefs are invalid. Invalid xrefs are silently skipped. Handles multiple marriages (multiple FAMS entries). Order is preserved from the GEDCOM file.
type InlineRepository ¶ added in v0.6.0
type InlineRepository struct {
// Name is the repository name
Name string
}
InlineRepository represents an inline repository definition within a Source. Used when a Source references a repository by name rather than by XRef.
type LDSOrdinance ¶ added in v0.3.0
type LDSOrdinance struct {
// Type is the ordinance type (BAPL, CONL, ENDL, SLGC, SLGS)
Type LDSOrdinanceType
// Date is when the ordinance was performed (DATE subordinate)
Date string
// ParsedDate is the parsed representation of Date.
// This is nil if the date string could not be parsed.
ParsedDate *Date
// Temple is the temple code where the ordinance was performed (TEMP subordinate)
Temple string
// Place is the place where the ordinance was performed (PLAC subordinate)
Place string
// Status is the ordinance status (STAT subordinate, e.g., "COMPLETED")
Status string
// FamilyXRef is the family cross-reference for SLGC (child sealing to parents)
// Only used with SLGC ordinance type (FAMC subordinate)
FamilyXRef string
}
LDSOrdinance represents an LDS (Latter-Day Saints) ordinance. Used by FamilySearch and other LDS genealogy software.
type LDSOrdinanceType ¶ added in v0.3.0
type LDSOrdinanceType string
LDSOrdinanceType represents the type of LDS (Latter-Day Saints) ordinance.
const ( // LDSBaptism (BAPL) - LDS baptism for the dead LDSBaptism LDSOrdinanceType = "BAPL" // LDSConfirmation (CONL) - LDS confirmation LDSConfirmation LDSOrdinanceType = "CONL" // LDSEndowment (ENDL) - LDS endowment LDSEndowment LDSOrdinanceType = "ENDL" // LDSSealingChild (SLGC) - LDS sealing of child to parents LDSSealingChild LDSOrdinanceType = "SLGC" // LDSSealingSpouse (SLGS) - LDS sealing of husband and wife LDSSealingSpouse LDSOrdinanceType = "SLGS" )
type MediaFile ¶ added in v0.3.0
type MediaFile struct {
// FileRef is the path or URL to the file
FileRef string
// Form is the MIME type (required in GEDCOM 7.0, e.g., "image/jpeg", "video/mp4")
Form string
// MediaType is the category (MEDI tag): AUDIO, BOOK, CARD, ELECTRONIC, PHOTO, VIDEO, etc.
MediaType string
// Title is a descriptive title for this file
Title string
// Translations contains alternate versions (transcripts, thumbnails, different formats)
Translations []*MediaTranslation
}
MediaFile represents a single file within a multimedia record (GEDCOM 7.0 FILE structure). A multimedia object can have multiple files (e.g., high-res and thumbnail versions).
type MediaLink ¶ added in v0.3.0
type MediaLink struct {
// Crop is an optional crop region for images
Crop *CropRegion
// MediaXRef is the pointer to the OBJE record (e.g., "@O1@")
MediaXRef string
// Title is an optional title that overrides the FILE's TITL
Title string
}
MediaLink represents a reference to a multimedia object (GEDCOM 7.0 MULTIMEDIA_LINK). Used when entities (individuals, families, events) reference media objects.
type MediaObject ¶
type MediaObject struct {
// ChangeDate is when the record was last modified (CHAN tag)
ChangeDate *ChangeDate
// CreationDate is when the record was created (CREA tag, GEDCOM 7.0)
CreationDate *ChangeDate
// Files contains 1:M file references (required, at least one)
Files []*MediaFile
// Notes are references to note records
Notes []string
// RefNumbers are user reference numbers (REFN tag, can have multiple)
RefNumbers []string
SharedNoteXRefs []string
// Restriction is the access restriction level (RESN tag)
Restriction string
// SourceCitations are source citations with page/quality details
SourceCitations []*SourceCitation
// Tags contains all raw tags for this media object (for unknown/custom tags)
Tags []*Tag
// UIDs are unique identifiers (UID tag, can have multiple in GEDCOM 7.0)
UIDs []string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// XRef is the cross-reference identifier for this media object
XRef string
}
MediaObject represents a multimedia record (GEDCOM 7.0 MULTIMEDIA_RECORD). This is a top-level record (0 @Xn@ OBJE) that stores the actual media files.
type MediaTranslation ¶ added in v0.3.0
type MediaTranslation struct {
// FileRef is the path or URL to the translation/alternate file
FileRef string
// Form is the MIME type of the translation file
Form string
}
MediaTranslation represents an alternate version of a file (GEDCOM 7.0 FILE-TRAN). Examples: transcripts for audio, thumbnails for images, different format conversions.
type Note ¶
type Note struct {
// XRef is the cross-reference identifier for this note
XRef string
// Text is the note content
Text string
// Continuation lines for multi-line notes
Continuation []string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// Tags contains all raw tags for this note (for unknown/custom tags)
Tags []*Tag
}
Note represents a textual note or annotation.
type PersonalName ¶
type PersonalName struct {
// Full is the full name (e.g., "John /Doe/")
Full string
// Given is the given (first) name
Given string
// Surname is the family name
Surname string
// Prefix is the name prefix (e.g., "Dr.", "Sir")
Prefix string
// Suffix is the name suffix (e.g., "Jr.", "III")
Suffix string
// Nickname is the person's nickname (e.g., "Bill" for William)
Nickname string
// SurnamePrefix is the surname prefix (e.g., "von", "de", "van der")
SurnamePrefix string
// Type is the name type (e.g., "birth", "married", "aka")
Type string
// Transliterations are alternative representations of the name in different
// writing systems or scripts (GEDCOM 7.0 TRAN tag). Used to store the same
// name in different languages, scripts, or romanization systems.
Transliterations []*Transliteration
}
PersonalName represents a person's name with optional components.
type PlaceDetail ¶ added in v0.3.0
type PlaceDetail struct {
// Name is the place name string
Name string
// Form is the hierarchical format of the place (e.g., "City, County, State, Country")
Form string
// Coordinates are optional geographic coordinates (MAP/LATI/LONG)
Coordinates *Coordinates
}
PlaceDetail represents a structured place with optional coordinates and format.
type Record ¶
type Record struct {
// XRef is the cross-reference identifier (e.g., "@I1@", "@F1@")
XRef string
// Type is the record type (INDI, FAM, SOUR, etc.)
Type RecordType
// Value is the value from the level 0 line (used for NOTE records, etc.)
Value string
// Tags contains all the tags that make up this record
Tags []*Tag
// LineNumber is the line number where the record starts
LineNumber int
// Parsed entity (one of: Individual, Family, Source, Repository, Note, MediaObject)
// Will be populated during decoding based on the Type
Entity interface{}
}
Record represents a top-level GEDCOM record with a cross-reference identifier. Records are the main entities in a GEDCOM file (individuals, families, sources, etc.).
func (*Record) GetIndividual ¶
func (r *Record) GetIndividual() (*Individual, bool)
GetIndividual returns the record as an Individual if it's the correct type.
func (*Record) GetMediaObject ¶ added in v0.3.0
func (r *Record) GetMediaObject() (*MediaObject, bool)
GetMediaObject returns the record as a MediaObject if it's the correct type.
func (*Record) GetNote ¶ added in v0.3.0
GetNote returns the record as a Note if it's the correct type.
func (*Record) GetRepository ¶ added in v0.3.0
func (r *Record) GetRepository() (*Repository, bool)
GetRepository returns the record as a Repository if it's the correct type.
func (*Record) GetSharedNote ¶ added in v1.1.0
func (r *Record) GetSharedNote() (*SharedNote, bool)
GetSharedNote returns the record as a SharedNote if it's the correct type.
func (*Record) GetSubmitter ¶ added in v0.3.0
GetSubmitter returns the record as a Submitter if it's the correct type.
func (*Record) IsIndividual ¶
IsIndividual returns true if this record is an individual record.
func (*Record) IsSharedNote ¶ added in v1.1.0
IsSharedNote returns true if this record is a shared note record (GEDCOM 7.0).
type RecordType ¶
type RecordType string
RecordType represents the type of GEDCOM record.
const ( // RecordTypeIndividual represents a person (INDI) RecordTypeIndividual RecordType = "INDI" // RecordTypeFamily represents a family unit (FAM) RecordTypeFamily RecordType = "FAM" // RecordTypeSource represents a source of information (SOUR) RecordTypeSource RecordType = "SOUR" // RecordTypeRepository represents a repository (REPO) RecordTypeRepository RecordType = "REPO" // RecordTypeNote represents a note (NOTE) RecordTypeNote RecordType = "NOTE" // RecordTypeMedia represents a multimedia object (OBJE) RecordTypeMedia RecordType = "OBJE" // RecordTypeSubmitter represents a submitter (SUBM) RecordTypeSubmitter RecordType = "SUBM" RecordTypeSharedNote RecordType = "SNOTE" )
type Repository ¶
type Repository struct {
// XRef is the cross-reference identifier for this repository
XRef string
// Name is the repository name
Name string
// Address is the physical address
Address *Address
// Notes are references to note records
Notes []string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// Tags contains all raw tags for this repository (for unknown/custom tags)
Tags []*Tag
}
Repository represents a physical or digital location where sources are stored.
type SchemaDefinition ¶ added in v1.1.0
type SchemaDefinition struct {
// TagMappings maps tag names to URIs (e.g., "_SKYPEID" -> "http://xmlns.com/foaf/0.1/skypeID")
TagMappings map[string]string
}
SchemaDefinition represents GEDCOM 7.0 schema mappings (SCHMA structure). Maps custom/extension tags to their URI definitions, enabling interoperability of vendor-specific extensions.
GEDCOM 7.0 structure:
0 HEAD
1 SCHMA
2 TAG <TagName> <URI>
Example:
0 HEAD
1 SCHMA
2 TAG _SKYPEID http://xmlns.com/foaf/0.1/skypeID
2 TAG _FACEBOOK https://www.facebook.com/
type SharedNote ¶ added in v1.1.0
type SharedNote struct {
XRef string
Text string
MIME string
Language string
Translations []*SharedNoteTranslation
SourceCitations []*SourceCitation
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
ChangeDate *ChangeDate
Tags []*Tag
}
SharedNote represents a GEDCOM 7.0 shared note record (SNOTE). Unlike regular NOTE records, shared notes support MIME types, language tags, and translations for internationalization.
type SharedNoteTranslation ¶ added in v1.1.0
SharedNoteTranslation represents a translation of a shared note into another language. This mirrors the Transliteration pattern used for PersonalName.
type Source ¶
type Source struct {
// XRef is the cross-reference identifier for this source
XRef string
// Title is the source title
Title string
// Author is the source author/originator
Author string
// Publication is publication information
Publication string
// Text is the actual text from the source
Text string
// RepositoryRef is the XRef to the repository where this source is stored
RepositoryRef string
// Repository is an inline repository definition (alternative to RepositoryRef)
Repository *InlineRepository
// Media are references to media objects with optional crop/title
Media []*MediaLink
// Notes are references to note records
Notes []string
// ChangeDate is when the record was last modified (CHAN tag)
ChangeDate *ChangeDate
// CreationDate is when the record was created (CREA tag, GEDCOM 7.0)
CreationDate *ChangeDate
// RefNumber is the user reference number (REFN tag)
RefNumber string
// UID is the unique identifier (UID tag)
UID string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// Tags contains all raw tags for this source (for unknown/custom tags)
Tags []*Tag
}
Source represents a source of genealogical information.
type SourceCitation ¶ added in v0.2.0
type SourceCitation struct {
// SourceXRef is the cross-reference to the source record (e.g., "@S1@")
SourceXRef string
// Page is the page or location within the source (e.g., "Page 42, Entry 103")
Page string
// Quality is the evidence quality assessment (0-3 scale per GEDCOM spec)
// 0 = unreliable evidence or estimated data
// 1 = questionable reliability of evidence
// 2 = secondary evidence, data officially recorded sometime after event
// 3 = direct and primary evidence used, or by dominance of the evidence
Quality int
// Data contains optional extracted text and date from the source
Data *SourceCitationData
// AncestryAPID is the Ancestry Permanent Identifier from the _APID tag.
// This is an Ancestry.com vendor extension that links the citation to a
// specific record in an Ancestry database. Use AncestryAPID.URL() to
// reconstruct the original Ancestry.com record URL.
AncestryAPID *AncestryAPID
}
SourceCitation represents a citation of a source with location and quality information.
type SourceCitationData ¶ added in v0.2.0
type SourceCitationData struct {
// Date is the date extracted from the source
Date string
// Text is the quoted text from the source
Text string
}
SourceCitationData represents extracted text and date from a source citation.
type Submitter ¶ added in v0.3.0
type Submitter struct {
// XRef is the cross-reference identifier for this submitter
XRef string
// Name is the submitter's name
Name string
// Address is the submitter's physical address
Address *Address
// Phone contains phone numbers (can have multiple)
Phone []string
// Email contains email addresses (can have multiple)
Email []string
// Language contains preferred languages (can have multiple)
Language []string
// Notes are references to note records
Notes []string
// ExternalIDs are external identifiers (EXID tags, GEDCOM 7.0).
// Links this record to external systems like FamilySearch, Ancestry, etc.
ExternalIDs []*ExternalID
// Tags contains all raw tags for this submitter (for unknown/custom tags)
Tags []*Tag
}
Submitter represents a person or organization who submitted genealogical data. In GEDCOM files, submitters are identified by SUBM records and provide attribution and contact information for data sources.
type Tag ¶
type Tag struct {
// Level is the hierarchical depth (0 for top-level records, 1+ for nested data)
Level int
// Tag is the GEDCOM tag name (e.g., "INDI", "NAME", "BIRT")
Tag string
// Value is the optional value associated with the tag
Value string
// XRef is the optional cross-reference identifier (e.g., "@I1@")
// Only present for records that can be referenced by other records
XRef string
// LineNumber is the line number in the source file where this tag appears
// Used for error reporting and debugging
LineNumber int
}
Tag represents a GEDCOM tag-value pair with hierarchical level information. Tags are the fundamental building blocks of GEDCOM files, representing structured data in a hierarchical format.
type Trailer ¶
type Trailer struct {
// LineNumber is the line number where the trailer appears
LineNumber int
}
Trailer marks the end of a GEDCOM file. The trailer is always a single line "0 TRLR" in valid GEDCOM files.
type Transformation ¶ added in v0.8.0
type Transformation struct {
// Type is a short identifier for the transformation (e.g., "XREF_UPPERCASE", "CONC_REMOVED")
Type string
// Description is a human-readable explanation of what was changed
Description string
// Count is the number of instances transformed
Count int
// Details contains optional specific information about what was transformed
Details []string
}
Transformation records a single type of change made during conversion.
type Transliteration ¶ added in v0.6.0
type Transliteration struct {
// Value is the full transliterated name in GEDCOM format (e.g., "John /Doe/").
// This is the value from the TRAN tag itself.
Value string
// Language is the BCP 47 language tag indicating the language/script of this
// transliteration (GEDCOM 7.0 LANG tag). Examples: "en-GB", "ja-Latn", "zh-Hans".
Language string
// Given is the transliterated given (first) name (GIVN tag).
Given string
// Surname is the transliterated family name (SURN tag).
Surname string
// Prefix is the transliterated name prefix, e.g., "Dr.", "Sir" (NPFX tag).
Prefix string
// Suffix is the transliterated name suffix, e.g., "Jr.", "III" (NSFX tag).
Suffix string
// Nickname is the transliterated nickname (NICK tag).
Nickname string
// SurnamePrefix is the transliterated surname prefix, e.g., "von", "de" (SPFX tag).
SurnamePrefix string
}
Transliteration represents an alternative representation of a name in a different writing system, script, or language (GEDCOM 7.0 TRAN tag under NAME). Each transliteration can include the full transliterated name value plus individual name components in that writing system.
type Vendor ¶ added in v0.6.0
type Vendor string
Vendor represents the software that created a GEDCOM file. It is detected from the HEAD.SOUR tag in the GEDCOM header.
const ( // VendorUnknown indicates the GEDCOM source could not be identified. VendorUnknown Vendor = "" // VendorAncestry represents Ancestry.com products including FamilyTreeMaker. VendorAncestry Vendor = "ancestry" // VendorFamilySearch represents FamilySearch.org. VendorFamilySearch Vendor = "familysearch" // VendorRootsMagic represents RootsMagic genealogy software. VendorRootsMagic Vendor = "rootsmagic" // VendorLegacy represents Legacy Family Tree software. VendorLegacy Vendor = "legacy" // VendorGramps represents the Gramps open-source genealogy software. VendorGramps Vendor = "gramps" // VendorMyHeritage represents MyHeritage genealogy service. VendorMyHeritage Vendor = "myheritage" )
Known vendor constants. These represent common genealogy software that produces GEDCOM files. VendorUnknown is returned when the source system cannot be identified.
func DetectVendor ¶ added in v0.6.0
DetectVendor identifies the GEDCOM vendor from the source system string. The source system is typically found in the HEAD.SOUR tag of a GEDCOM file. Detection is case-insensitive and uses substring matching. Returns VendorUnknown if the source system is not recognized.
type Version ¶
type Version string
Version represents a GEDCOM specification version.
func (Version) Before ¶ added in v1.1.0
Before returns true if v is an older version than other. Returns false if either version is unknown.