database

package
v0.0.0-...-13997a8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const NoSuchOrgError = "no such organization"

NoSuchOrgError is the error message on no such organization

View Source
const Self = "USER"

Self is the constant that represents the user disclosing something him- or herself.

Variables

View Source
var DB *bolt.DB

DB is our database presumably created somewhere else.

Functions

func AddAttribute

func AddAttribute(a model.Attribute) (err error)

AddAttribute adds an attribute to the database.

func AddAttributes

func AddAttributes(as []model.Attribute, wg *sync.WaitGroup, errChan chan error)

AddAttributes adds many attributes at once.

func AddCategory

func AddCategory(c model.Category) (err error)

AddCategory adds a category to the database.

func AddCoordinates

func AddCoordinates(cs []model.Coordinate, wg *sync.WaitGroup, errChan chan error)

AddCoordinates adds many coordinates at once.

func AddDisclosed

func AddDisclosed(d model.Disclosed) (err error)

AddDisclosed adds that a disclosure disclosed many attributes.

func AddDiscloseds

func AddDiscloseds(ds []model.Disclosed, wg *sync.WaitGroup, errChan chan error)

AddDiscloseds adds many disclosed at once.

func AddDisclosure

func AddDisclosure(d model.Disclosure) (err error)

AddDisclosure adds a disclosure to the database.

func AddDisclosures

func AddDisclosures(ds []model.Disclosure, wg *sync.WaitGroup, errChan chan error)

AddDisclosures adds many disclosures at once.

func AddDownstream

func AddDownstream(d model.Downstream) (err error)

AddDownstream adds a downstream relationship.

func AddDownstreams

func AddDownstreams(ds []model.Downstream, wg *sync.WaitGroup, errChan chan error)

AddDownstreams adds many downstream at once.

func AddOrganization

func AddOrganization(o model.Organization) (err error)

AddOrganization adds an organization to the database.

func Close

func Close() (err error)

Close attempts to close the database.

func GetAttribute

func GetAttribute(id string) (a *model.Attribute, err error)

GetAttribute returns the attribute with the provided id.

func GetAttributeIDs

func GetAttributeIDs() (IDs []string, err error)

GetAttributeIDs returns all attribute identifiers.

func GetAttributeIDsToOrg

func GetAttributeIDsToOrg(org string) (IDs []string, err error)

GetAttributeIDsToOrg returns all attribute IDs disclosed to an organization.

func GetAttributeTypeIDs

func GetAttributeTypeIDs() (IDs []string, err error)

GetAttributeTypeIDs returns all attribute type IDs.

func GetAttributeTypeIDsToOrg

func GetAttributeTypeIDsToOrg(org string) (IDs []string, err error)

GetAttributeTypeIDsToOrg returns all attribute type IDs disclosed to an organization.

func GetAttributeTypeValues

func GetAttributeTypeValues(thetype string) (values []string, err error)

GetAttributeTypeValues returns all attribute values for a type.

func GetAttributeTypeValuesToOrg

func GetAttributeTypeValuesToOrg(org string, thetype string) (values []string, err error)

GetAttributeTypeValuesToOrg returns all attribute type values disclosed to an organization.

func GetCategory

func GetCategory(id string) (c []model.Category, err error)

GetCategory returns the category with the provided identifier.

func GetCoordinates

func GetCoordinates(neLat, neLng, swLat, swLng string) (reply []model.Coordinate, err error)

GetCoordinates gets the coordinates within (inclusive)

func GetDisclosed

func GetDisclosed(id string) (d *model.Disclosed, err error)

GetDisclosed gets the disclosed for a specific disclosure id.

func GetDisclosure

func GetDisclosure(id string) (d *model.Disclosure, err error)

GetDisclosure returns the disclosure with the provided id.

func GetDisclosureIDs

func GetDisclosureIDs() (IDs []string, err error)

GetDisclosureIDs returns all the data disclosure IDs.

func GetDisclosureIDsChrono

func GetDisclosureIDsChrono() (IDs []string, err error)

GetDisclosureIDsChrono returns all the data disclosure IDs sorted chronologically.

func GetDisclosureIDsToOrg

func GetDisclosureIDsToOrg(org string) (IDs []string, err error)

GetDisclosureIDsToOrg returns all data disclosure IDs to a particular organization.

func GetDisclosureIDsToOrgChrono

func GetDisclosureIDsToOrgChrono(org string) (IDs []string, err error)

GetDisclosureIDsToOrgChrono returns all data disclosure IDs to a particular organization in chronological order.

func GetDownstreamDisclosureIDs

func GetDownstreamDisclosureIDs(id string) (IDs []string, err error)

GetDownstreamDisclosureIDs returns all data disclosures (their IDs) that were shared downstream with the provided data disclosure as the origin/source.

func GetDownstreamDisclosureIDsChrono

func GetDownstreamDisclosureIDsChrono(id string) (IDs []string, err error)

GetDownstreamDisclosureIDsChrono is like GetDownstreamDisclosureIDs, but also sorts the identifiers in chronological order.

func GetExplicitDisclosureIDsToOrg

func GetExplicitDisclosureIDsToOrg(org string) (IDs []string, err error)

GetExplicitDisclosureIDsToOrg is like GetDisclosureIDsToOrg, but explicit.

func GetExplicitlyDisclosedAttributeIDs

func GetExplicitlyDisclosedAttributeIDs() (IDs []string, err error)

GetExplicitlyDisclosedAttributeIDs returns all explicitly disclosed attributes.

func GetExplicitlyDisclosedAttributeIDsToOrg

func GetExplicitlyDisclosedAttributeIDsToOrg(org string) (IDs []string, err error)

GetExplicitlyDisclosedAttributeIDsToOrg is like GetAttributeIDsToOrg but for explicitly disclosed attributes only.

func GetExplicitlyDisclosedAttributeTypeIDs

func GetExplicitlyDisclosedAttributeTypeIDs() (IDs []string, err error)

GetExplicitlyDisclosedAttributeTypeIDs returns all attribute type IDs for explicitly disclosed disclosures.

func GetExplicitlyDisclosedAttributeTypeIDsToOrg

func GetExplicitlyDisclosedAttributeTypeIDsToOrg(org string) (IDs []string, err error)

GetExplicitlyDisclosedAttributeTypeIDsToOrg returns all attribute type IDs for explicitly disclosed disclosures to a particular organization.

func GetExplicitlyDisclosedAttributeTypeValues

func GetExplicitlyDisclosedAttributeTypeValues(thetype string) (values []string, err error)

GetExplicitlyDisclosedAttributeTypeValues returns all attribute values for a type for explicitly disclosed disclosures.

func GetExplicitlyDisclosedAttributeTypeValuesToOrg

func GetExplicitlyDisclosedAttributeTypeValuesToOrg(org string, thetype string) (values []string, err error)

GetExplicitlyDisclosedAttributeTypeValuesToOrg returns all attribute values for a type for explicitly disclosed disclosures to a particular organization.

func GetImplicitDisclosureIDs

func GetImplicitDisclosureIDs(id string) (IDs []string, err error)

GetImplicitDisclosureIDs returns all data disclosures that a recipient of the provided disclosure has derived from the provided disclosure.

func GetImplicitDisclosureIDsChrono

func GetImplicitDisclosureIDsChrono(id string) (IDs []string, err error)

GetImplicitDisclosureIDsChrono is like GetImplicitDisclosureIDs, but also sorts the identifiers in chronological order.

func GetImplicitlyDisclosedAttributeIDs

func GetImplicitlyDisclosedAttributeIDs() (IDs []string, err error)

GetImplicitlyDisclosedAttributeIDs returns all implicitly disclosed attributes.

func GetImplicitlyDisclosedAttributeIDsToOrg

func GetImplicitlyDisclosedAttributeIDsToOrg(org string) (IDs []string, err error)

GetImplicitlyDisclosedAttributeIDsToOrg is like GetAttributeIDsToOrg but for implicitly disclosed attributes only.

func GetImplicitlyDisclosedAttributeTypeIDs

func GetImplicitlyDisclosedAttributeTypeIDs() (IDs []string, err error)

GetImplicitlyDisclosedAttributeTypeIDs returns all attribute type IDs for implicity disclosed disclosures.

func GetImplicitlyDisclosedAttributeTypeIDsToOrg

func GetImplicitlyDisclosedAttributeTypeIDsToOrg(org string) (IDs []string, err error)

GetImplicitlyDisclosedAttributeTypeIDsToOrg returns all attribute type IDs for implicity disclosed disclosures to a particular organization.

func GetImplicitlyDisclosedAttributeTypeValues

func GetImplicitlyDisclosedAttributeTypeValues(thetype string) (values []string, err error)

GetImplicitlyDisclosedAttributeTypeValues returns all attribute values for a type for implicty disclosed disclosures.

func GetImplicitlyDisclosedAttributeTypeValuesToOrg

func GetImplicitlyDisclosedAttributeTypeValuesToOrg(org, thetype string) (values []string, err error)

GetImplicitlyDisclosedAttributeTypeValuesToOrg returns all attribute values for a type for implicty disclosed disclosures to a particular organization.

func GetImplictDisclosureIDsToOrg

func GetImplictDisclosureIDsToOrg(org string) (IDs []string, err error)

GetImplictDisclosureIDsToOrg is like GetDisclosureIDsToOrg, but implicit.

func GetNextCoordinateChrono

func GetNextCoordinateChrono(id string) (exists bool, next model.Coordinate, err error)

GetNextCoordinateChrono returns the next coordinate disclosed after the coordinate with the provided identifier.

func GetOrganization

func GetOrganization(id string) (org *model.Organization, err error)

GetOrganization returns the organization with the provided identifier. Returns NoSuchOrgError on no organization with the provided identifier.

func GetOrganizationIDs

func GetOrganizationIDs() (IDs []string, err error)

GetOrganizationIDs returns all the organization IDs.

func GetPrevCoordinateChrono

func GetPrevCoordinateChrono(id string) (exists bool, prev model.Coordinate, err error)

GetPrevCoordinateChrono returns the previous coordinate disclosed before the coordinate with the provided identifier.

func GetReceivingOrgIDs

func GetReceivingOrgIDs(attribute string) (IDs []string, err error)

GetReceivingOrgIDs returns the organization IDs of organizations that have received a particular attribute.

func GetUser

func GetUser() (u *model.User, err error)

GetUser returns the user data.

func PadCoordinate

func PadCoordinate(coord string) string

PadCoordinate pads the coordinate with prefix zeroes

func SetUser

func SetUser(u model.User) (err error)

SetUser sets the user info, replacing if already in place.

func Setup

func Setup() (err error)

Setup creates all buckets for bolt.

func Start

func Start(file string) (err error)

Start attempts to start the database from the provided file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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