Skip to content
/ datum Public

Tools for serializing Geospatial Primitives w/ database/sql and sqlboiler

License

Notifications You must be signed in to change notification settings

1build/datum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datum GoDoc

Datum is a set of tools for serializing geospatial primitives with database/sql & volatiletech/sqlboiler. It's currently limited to point, nullPoint, and nullGeometryCollection.

Example

Below is a minimal example of using datum to serialize a geospatial point to a record with sqlboiler generated structs.

    import (
        "log"

        "gitub.com/myorg/path/to/sqlboiler/models"
        "github.com/1build/datum"
    )

    const srid := 4326

    record := &models.Supplier{
        Name: input.Name,
        Location: datum.Point{
            SRID: srid,
            Lat:  input.Lat,
            Lng:  input.Lng,
        },
    }

    if err := record.Insert(ctx, tx, boil.Infer()); err != nil {
        warning := fmt.Sprintf("[Supplier.Repository.CreateSupplier]: Couldn't create new supplier: %s", input.Name)
        log.Panic(warning)

        return nil, errors.New(warning)
    }

About

Tools for serializing Geospatial Primitives w/ database/sql and sqlboiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages