shdb

package
v0.0.0-...-16f8954 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateTimeFormat  = "%Y-%m-%dT%H:%i:%s.%fZ"
	MapOrgNamesFile = "map_org_names.yaml"
)

DateTimeFormat - this is how we format datetime for MariaDB

Variables

This section is empty.

Functions

func ToLowerAndNone

func ToLowerAndNone(value string) string

ToLowerAndNone takes a string if it is empty it is set to none else it's contents are changed to the lower case

Types

type Service

type Service interface {
	shared.ServiceInterface
	// External CRUD methods
	// Country
	GetCountry(string, *sql.Tx) (*models.CountryDataOutput, error)
	// Profile
	GetProfile(string, bool, *sql.Tx) (*models.ProfileDataOutput, error)
	EditProfile(*models.ProfileDataOutput, bool, *sql.Tx) (*models.ProfileDataOutput, error)
	AddProfile(*models.ProfileDataOutput, bool, *sql.Tx) (*models.ProfileDataOutput, error)
	ValidateProfile(*models.ProfileDataOutput, *sql.Tx) error
	DeleteProfile(string, bool, bool, *time.Time, *sql.Tx) error
	ArchiveProfile(string, *time.Time, *sql.Tx) error
	UnarchiveProfile(string, bool, *time.Time, *sql.Tx) error
	DeleteProfileArchive(string, bool, bool, *time.Time, *sql.Tx) error
	FindProfiles([]string, []interface{}, bool, *sql.Tx) ([]*models.ProfileDataOutput, error)
	ProfileUUIDHash(*models.ProfileDataOutput) (string, error)
	// Identity
	TouchIdentity(string, *sql.Tx) (int64, error)
	GetIdentity(string, bool, *sql.Tx) (*models.IdentityDataOutput, error)
	GetIdentityByUser(string, string, bool, *sql.Tx) (identityData *models.IdentityDataOutput, err error)
	EditIdentity(*models.IdentityDataOutput, bool, *sql.Tx) (*models.IdentityDataOutput, error)
	DeleteIdentity(string, bool, bool, *time.Time, *sql.Tx) error
	ArchiveIdentity(string, *time.Time, *sql.Tx) error
	UnarchiveIdentity(string, bool, *time.Time, *sql.Tx) error
	DeleteIdentityArchive(string, bool, bool, *time.Time, *sql.Tx) error
	ValidateIdentity(*models.IdentityDataOutput, bool) error
	FindIdentities([]string, []interface{}, []bool, bool, *sql.Tx) ([]*models.IdentityDataOutput, error)
	AddIdentity(*models.IdentityDataOutput, bool, bool, *sql.Tx) (*models.IdentityDataOutput, error)
	IdentityIDHash(*models.IdentityDataOutput) (string, error)
	// UniqueIdentity
	TouchUniqueIdentity(string, *sql.Tx) (int64, error)
	AddUniqueIdentity(*models.UniqueIdentityDataOutput, bool, *sql.Tx) (*models.UniqueIdentityDataOutput, error)
	GetUniqueIdentity(string, bool, *sql.Tx) (*models.UniqueIdentityDataOutput, error)
	DeleteUniqueIdentity(string, bool, bool, *time.Time, *sql.Tx) error
	ArchiveUniqueIdentity(string, *time.Time, *sql.Tx) error
	UnarchiveUniqueIdentity(string, bool, *time.Time, *sql.Tx) error
	DeleteUniqueIdentityArchive(string, bool, bool, *time.Time, *sql.Tx) error
	QueryUniqueIdentitiesNested(string, int64, int64, bool, []string, *sql.Tx) ([]*models.UniqueIdentityNestedDataOutput, int64, error)
	// Enrollment
	GetEnrollment(int64, bool, *sql.Tx) (*models.EnrollmentDataOutput, error)
	FindEnrollments([]string, []interface{}, []bool, bool, *sql.Tx) ([]*models.EnrollmentDataOutput, error)
	EditEnrollment(*models.EnrollmentDataOutput, bool, *sql.Tx) (*models.EnrollmentDataOutput, error)
	AddEnrollment(*models.EnrollmentDataOutput, bool, bool, *sql.Tx) (*models.EnrollmentDataOutput, error)
	DeleteEnrollment(int64, bool, bool, *time.Time, *sql.Tx) error
	ArchiveEnrollment(int64, *time.Time, *sql.Tx) error
	UnarchiveEnrollment(int64, bool, *time.Time, *sql.Tx) error
	DeleteEnrollmentArchive(int64, bool, bool, *time.Time, *sql.Tx) error
	ValidateEnrollment(*models.EnrollmentDataOutput, bool) error
	// Organization
	FindOrganizations([]string, []interface{}, bool, *sql.Tx) ([]*models.OrganizationDataOutput, error)
	QueryOrganizationsNested(string, int64, int64, *sql.Tx) ([]*models.OrganizationNestedDataOutput, int64, error)
	AddOrganization(*models.OrganizationDataOutput, bool, *sql.Tx) (*models.OrganizationDataOutput, error)
	EditOrganization(*models.OrganizationDataOutput, bool, *sql.Tx) (*models.OrganizationDataOutput, error)
	GetOrganization(int64, bool, *sql.Tx) (*models.OrganizationDataOutput, error)
	GetOrganizationByName(string, bool, *sql.Tx) (*models.OrganizationDataOutput, error)
	DropOrganization(int64, bool, *sql.Tx) error
	ValidateOrganization(*models.OrganizationDataOutput, bool) error
	// Organization Domain
	DropOrgDomain(string, string, bool, *sql.Tx) error
	QueryOrganizationsDomains(int64, string, int64, int64, *sql.Tx) ([]*models.DomainDataOutput, int64, error)
	// MatchingBlacklist
	QueryMatchingBlacklist(*sql.Tx, string, int64, int64) ([]*models.MatchingBlacklistOutput, int64, error)
	AddMatchingBlacklist(*models.MatchingBlacklistOutput, bool, *sql.Tx) (*models.MatchingBlacklistOutput, error)
	FetchMatchingBlacklist(string, bool, *sql.Tx) (*models.MatchingBlacklistOutput, error)
	DropMatchingBlacklist(string, bool, *sql.Tx) error
	// Slug Mappings
	GetSlugMappings(bool) error
	GetSkippedProjects() (map[string]bool, error)
	IsProjectSkipped(project string) (isSkipped bool, err error)
	GetListSlugMappings() (*models.ListSlugMappings, error)
	FindSlugMappings([]string, []interface{}, bool, *sql.Tx) ([]*models.SlugMapping, error)
	AddSlugMapping(*models.SlugMapping, *sql.Tx) (*models.SlugMapping, error)
	DeleteSlugMapping(string) (*models.TextStatusOutput, error)
	DropSlugMapping(string, bool, *sql.Tx) error
	EditSlugMapping(*models.SlugMapping, *models.SlugMapping, *sql.Tx) (*models.SlugMapping, error)
	// Affiliations (5-step algorithm)
	GetAffiliations(string, string, time.Time, bool, *sql.Tx) []string
	GetAffiliationsSingle(string, string, time.Time, *sql.Tx) string
	GetAffiliationsMulti(string, string, time.Time, *sql.Tx) []string
	// Other
	SetIsLFX(*models.UniqueIdentityNestedDataOutput)
	SyncSfProfiles(map[[3]string]struct{}) (string, error)
	MakeLFXIdentityPrimary(chan []interface{}, string) (int, error)
	MoveIdentityToUniqueIdentity(*models.IdentityDataOutput, *models.UniqueIdentityDataOutput, bool, *sql.Tx) error
	GetArchiveUniqueIdentityEnrollments(string, time.Time, bool, *sql.Tx) ([]*models.EnrollmentDataOutput, error)
	GetArchiveUniqueIdentityIdentities(string, time.Time, bool, *sql.Tx) ([]*models.IdentityDataOutput, error)
	GetUniqueIdentityEnrollments(string, bool, *sql.Tx) ([]*models.EnrollmentDataOutput, error)
	GetUniqueIdentityIdentities(string, bool, *sql.Tx) ([]*models.IdentityDataOutput, error)
	MoveEnrollmentToUniqueIdentity(*models.EnrollmentDataOutput, *models.UniqueIdentityDataOutput, *sql.Tx) error
	MergeEnrollments(*models.UniqueIdentityDataOutput, *models.OrganizationDataOutput, *string, bool, bool, *sql.Tx) error
	MergeDateRanges([][]strfmt.DateTime) ([][]strfmt.DateTime, error)
	FindUniqueIdentityOrganizations(string, bool, *sql.Tx) ([]*models.OrganizationDataOutput, error)
	ArchiveUUID(string, *time.Time, *sql.Tx) (*time.Time, error)
	UnarchiveUUID(string, time.Time, *sql.Tx) error
	SetProfileEmptyDataFromIdentities(string, []*models.IdentityDataOutput, *sql.Tx) error
	Unarchive(string, string) (bool, error)
	CheckUnaffiliated([]*models.UnaffiliatedDataOutput, []string, *sql.Tx) ([]*models.UnaffiliatedDataOutput, error)
	EnrichContributors([]*models.ContributorFlatStats, []string, int64, *sql.Tx) error
	GetDetAffRangeSubjects() ([]*models.EnrollmentProjectRange, error)
	UpdateAffRange([]*models.EnrollmentProjectRange) (string, error)
	UpdateProjectSlugs(map[string][]string) (string, error)
	DedupEnrollments() error
	BeginTx() (*sql.Tx, error)
	SetLFID(string)

	// API endpoints
	GetMatchingBlacklist(string, int64, int64) (*models.GetMatchingBlacklistOutput, error)
	PostMatchingBlacklist(string) (*models.MatchingBlacklistOutput, error)
	DeleteMatchingBlacklist(string) (*models.TextStatusOutput, error)
	DeleteOrganization(int64) (*models.TextStatusOutput, error)
	DeleteOrgDomain(string, string) (*models.TextStatusOutput, error)
	DeleteProfileNested(string, bool) (*models.TextStatusOutput, error)
	UnarchiveProfileNested(string, []string) (*models.UniqueIdentityNestedDataOutput, error)
	GetListOrganizations(string, int64, int64) (*models.GetListOrganizationsOutput, error)
	GetListOrganizationsDomains(int64, string, int64, int64) (*models.GetListOrganizationsDomainsOutput, error)
	GetListProfiles(string, int64, int64, []string) (*models.GetListProfilesOutput, error)
	AddNestedUniqueIdentity(string) (*models.UniqueIdentityNestedDataOutput, error)
	AddNestedIdentity(*models.IdentityDataOutput) (*models.UniqueIdentityNestedDataOutput, error)
	AddIdentities([]*models.IdentityDataOutput) (string, error)
	FindEnrollmentsNested([]string, []interface{}, []bool, bool, []string, *sql.Tx) ([]*models.EnrollmentNestedDataOutput, error)
	WithdrawEnrollment(*models.EnrollmentDataOutput, bool, *sql.Tx) error
	PutOrgDomain(string, string, bool, bool, bool) (*models.PutOrgDomainOutput, error)
	MergeUniqueIdentities(string, string, bool, *sql.Tx) (string, bool, error)
	MoveIdentity(string, string, bool, *sql.Tx) error
	GetAllAffiliations() (*models.AllArrayOutput, error)
	BulkUpdate([]*models.AllOutput, []*models.AllOutput) (int, int, int, error)
	MergeAll(int, bool, string, elastic.Service) (string, error)
	HideEmails() (string, error)
	MapOrgNames() (string, error)
}

Service - access affiliations MariaDB interface

func New

func New(db, rodb *sqlx.DB, origin string) Service

New creates new db service instance with given db

Jump to

Keyboard shortcuts

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