Documentation ¶
Index ¶
- Variables
- func AddStagingResource(obj interface{}, id string, typeName string) error
- func BatchDeleteResourcesFromResources(resources ...Identifiable) error
- func BatchDeleteStagingFromResources(resources ...Identifiable) error
- func BatchMarkInvalidInStaging(resources []Identifiable) error
- func BatchMarkValidInStaging(resources []Identifiable) error
- func BulkAddStaging(items ...Storeable) error
- func BulkAddStagingForDelete(items ...Identifiable) error
- func BulkAddStagingResources(resources ...StagingResource) error
- func BulkMoveStagingToResourcesByFilter(typeName string, filter Filter, items ...StagingResource) error
- func BulkMoveStagingTypeToResources(typeName string, items ...StagingResource) error
- func BulkRemoveResources(items ...Identifiable) error
- func BulkRemoveStagingDeletedFromResources(typeName string) error
- func ClearAllResources() error
- func ClearAllStaging() error
- func ClearDeletedFromStaging(id string, typeName string) error
- func ClearFilteredDeletedFromStaging(filter Filter, typeName string) error
- func ClearResourceType(typeName string) error
- func ClearStagingType(typeName string) error
- func ClearStagingTypeDeletes(typeName string) error
- func ClearStagingTypeValid(typeName string) error
- func ClearStagingTypeValidByFilter(typeName string, filter Filter) error
- func DeleteFromStaging(res StagingResource) error
- func Difference(a, b []string) (diff []string)
- func DropResources() error
- func DropStaging() error
- func FilterTypeStaging(typeName string, validator ValidatorFunc) ([]Identifiable, []Identifiable, error)
- func FilterTypeStagingByQuery(typeName string, filter Filter, validator ValidatorFunc) ([]Identifiable, []Identifiable, error)
- func FlagDeletes(sourceDataIds []string, existingData []Resource, config DiffProcessConfig) error
- func GetDbName() string
- func GetMaxUpdatedAt(typeName string) time.Time
- func GetPool() *pgxpool.Pool
- func IntakeInChunks(ins ChunkableIntakeConfig) error
- func MakeConnectionPool(conf Config) error
- func MakeResourceSchema()
- func MakeStagingSchema()
- func MarkInvalidInStaging(res Storeable) error
- func MarkValidInStaging(res StagingResource) error
- func ProcessDiff(config DiffProcessConfig) error
- func ProcessOutake(config OutakeProcessConfig) error
- func ProcessSingleStaging(item Identifiable, validator ValidatorFunc) error
- func ProcessTypeStaging(typeName string, validator ValidatorFunc) error
- func ProcessTypeStagingFiltered(typeName string, filter Filter, validator ValidatorFunc) error
- func RemoveStagingDeletedFromResources(id string, typeName string) error
- func RemoveStagingDeletedFromResourcesFiltered(filter Filter, typeName string) error
- func ResourceCount(typeName string) int
- func ResourceTableExists() bool
- func SaveResource(obj Storeable) error
- func SaveStagingResource(obj Storeable) error
- func SaveStagingResourceDirect(res StagingResource, typeName string) error
- func StagingCount() int
- func StagingDeleteCount(typeName string) int
- func StagingResourceExists(id string, typeName string) bool
- func StagingTableExists() bool
- func StashStaging(docs ...Storeable) error
- type ChunkableIntakeConfig
- type CompareOpt
- type Config
- type DatabaseInfo
- type DeleteChecker
- type DiffProcessConfig
- type ExistingListMaker
- type Filter
- type Identifiable
- type Identifier
- type IntakeListMaker
- type JustTestingInspector
- type OutakeListMaker
- type OutakeProcessConfig
- type Packet
- type ProgressChecker
- type Resource
- func RetrieveSingleResource(id string, typeName string) (Resource, error)
- func RetrieveTypeResources(typeName string) ([]Resource, error)
- func RetrieveTypeResourcesByQuery(typeName string, filter Filter) ([]Resource, error)
- func RetrieveTypeResourcesLimited(typeName string, limit int) ([]Resource, error)
- func ScanResources(rows pgx.Rows) ([]Resource, error)
- type ResourceListMaker
- type StagingResource
- func RetrieveAllStaging() ([]StagingResource, error)
- func RetrieveFilteredStagingDelete(filter Filter, typeName string) ([]StagingResource, error)
- func RetrieveInvalidStaging(typeName string) ([]StagingResource, error)
- func RetrieveSingleStaging(id string, typeName string) (StagingResource, error)
- func RetrieveSingleStagingDelete(id string, typeName string) (StagingResource, error)
- func RetrieveSingleStagingValid(id string, typeName string) (StagingResource, error)
- func RetrieveTypeStaging(typeName string) ([]StagingResource, error)
- func RetrieveTypeStagingFiltered(typeName string, filter Filter) ([]StagingResource, error)
- func RetrieveValidStaging(typeName string) ([]StagingResource, error)
- func RetrieveValidStagingFiltered(typeName string, filter Filter) ([]StagingResource, error)
- func ScanStaging(rows pgx.Rows) ([]StagingResource, error)
- type Storeable
- type Stub
- type SubFilter
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
var DBPool *pgxpool.Pool
var Name string
Functions ¶
func AddStagingResource ¶
only add (presumed existence already checked)
func BatchDeleteResourcesFromResources ¶
func BatchDeleteResourcesFromResources(resources ...Identifiable) error
func BatchDeleteStagingFromResources ¶
func BatchDeleteStagingFromResources(resources ...Identifiable) error
func BatchMarkInvalidInStaging ¶
func BatchMarkInvalidInStaging(resources []Identifiable) error
func BatchMarkValidInStaging ¶
func BatchMarkValidInStaging(resources []Identifiable) error
func BulkAddStaging ¶
func BulkAddStagingForDelete ¶
func BulkAddStagingForDelete(items ...Identifiable) error
func BulkAddStagingResources ¶
func BulkAddStagingResources(resources ...StagingResource) error
func BulkMoveStagingToResourcesByFilter ¶ added in v0.0.8
func BulkMoveStagingToResourcesByFilter(typeName string, filter Filter, items ...StagingResource) error
NOTE: still need typname to clear from staging
func BulkMoveStagingTypeToResources ¶
func BulkMoveStagingTypeToResources(typeName string, items ...StagingResource) error
NOTE: only need 'typeName' param for clearing out from staging
func BulkRemoveResources ¶
func BulkRemoveResources(items ...Identifiable) error
func ClearAllResources ¶
func ClearAllResources() error
func ClearAllStaging ¶
func ClearAllStaging() error
func ClearDeletedFromStaging ¶
func ClearFilteredDeletedFromStaging ¶ added in v0.0.13
func ClearResourceType ¶
func ClearStagingType ¶
call where valid = true? (after transfering to resources)
func ClearStagingTypeDeletes ¶
func ClearStagingTypeValid ¶
leave the is_valid = false for investigation
func ClearStagingTypeValidByFilter ¶ added in v0.0.8
func DeleteFromStaging ¶
func DeleteFromStaging(res StagingResource) error
func DropResources ¶
func DropResources() error
func DropStaging ¶
func DropStaging() error
func FilterTypeStaging ¶
func FilterTypeStaging(typeName string, validator ValidatorFunc) ([]Identifiable, []Identifiable, error)
func FilterTypeStagingByQuery ¶ added in v0.0.6
func FilterTypeStagingByQuery(typeName string, filter Filter, validator ValidatorFunc) ([]Identifiable, []Identifiable, error)
NOTE: this needs a 'typeName' param because it assumes validator is different per type
func FlagDeletes ¶ added in v0.0.9
func FlagDeletes(sourceDataIds []string, existingData []Resource, config DiffProcessConfig) error
func GetMaxUpdatedAt ¶
func IntakeInChunks ¶
func IntakeInChunks(ins ChunkableIntakeConfig) error
func MakeConnectionPool ¶
NOTE: Prepared statements can be manually created with the Prepare method. However, this is rarely necessary because pgx includes an automatic statement cache by default
func MakeStagingSchema ¶
func MakeStagingSchema()
func MarkInvalidInStaging ¶
TODO: should probably batch these when validating and mark valid, invalid in groups of 500 or something
func MarkValidInStaging ¶
func MarkValidInStaging(res StagingResource) error
func ProcessDiff ¶ added in v0.0.9
func ProcessDiff(config DiffProcessConfig) error
func ProcessOutake ¶
func ProcessOutake(config OutakeProcessConfig) error
func ProcessSingleStaging ¶
func ProcessSingleStaging(item Identifiable, validator ValidatorFunc) error
func ProcessTypeStaging ¶
func ProcessTypeStaging(typeName string, validator ValidatorFunc) error
func ProcessTypeStagingFiltered ¶ added in v0.0.6
func ProcessTypeStagingFiltered(typeName string, filter Filter, validator ValidatorFunc) error
TODO: no test for this so far
func RemoveStagingDeletedFromResourcesFiltered ¶ added in v0.0.13
func ResourceCount ¶
func SaveResource ¶
only does one at a time (not typically used)
func SaveStagingResource ¶
is there a need for this function?
func SaveStagingResourceDirect ¶
func SaveStagingResourceDirect(res StagingResource, typeName string) error
func StagingDeleteCount ¶
NOTE: only used in test - for verification
func StagingResourceExists ¶
returns false if error - maybe should not
func StashStaging ¶
Types ¶
type ChunkableIntakeConfig ¶
type ChunkableIntakeConfig struct { Count int ChunkSize int JustTest bool TypeName string ListMaker IntakeListMaker Progress ProgressChecker Inspector JustTestingInspector }
type CompareOpt ¶ added in v0.0.6
type CompareOpt string
const ( Eq CompareOpt = "=" Gt CompareOpt = ">" Lt CompareOpt = "<" Gte CompareOpt = ">=" Lte CompareOpt = "<=" In CompareOpt = "IN" )
type DatabaseInfo ¶
type DeleteChecker ¶
type DeleteChecker func([]string)
type DiffProcessConfig ¶
type DiffProcessConfig struct { TypeName string ExistingListMaker ExistingListMaker ListMaker OutakeListMaker JustTest bool Checker DeleteChecker Inspector JustTestingInspector }
to look for diffs for duid (for instance) both lists have to be sent in
type ExistingListMaker ¶
type Filter ¶ added in v0.0.6
type Filter struct { Field string Value string Compare CompareOpt SubFilter *SubFilter }
type Identifiable ¶
type Identifiable interface {
Identifier() Identifier
}
func RetrieveDeletedStaging ¶
func RetrieveDeletedStaging(typeName string) ([]Identifiable, error)
type Identifier ¶
type Identifier struct {
Id, Type string
}
type IntakeListMaker ¶
type JustTestingInspector ¶
type JustTestingInspector func(...interface{})
type OutakeListMaker ¶
maybe interface instead of func type in struct?
type OutakeProcessConfig ¶
type OutakeProcessConfig struct { TypeName string ListMaker OutakeListMaker JustTest bool Checker DeleteChecker Inspector JustTestingInspector }
NOTE: this is mostly the same as DiffProcessConfig
type Packet ¶
type Packet struct { Id Identifier Obj interface{} // this will be serialized }
func (Packet) Identifier ¶
func (p Packet) Identifier() Identifier
type ProgressChecker ¶
type ProgressChecker func(int)
type Resource ¶
type Resource struct { Id string `db:"id"` Type string `db:"type"` Hash string `db:"hash"` Data pgtype.JSON `db:"data"` DataB pgtype.JSONB `db:"data_b"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
this is the raw structure in the database two json columms: * 'data' can be used for change comparison with hash * 'data_b' can be used for searches
func RetrieveSingleResource ¶ added in v0.0.3
func RetrieveTypeResources ¶
func RetrieveTypeResourcesByQuery ¶ added in v0.0.6
func ScanResources ¶ added in v0.0.6
TODO: could just send in date - leave it up to library user to determine how it's figured out
func (Resource) Identifier ¶
func (res Resource) Identifier() Identifier
type ResourceListMaker ¶ added in v0.0.9
type StagingResource ¶
type StagingResource struct { Id string `db:"id"` Type string `db:"type"` Data []byte `db:"data"` IsValid sql.NullBool `db:"is_valid"` ToDelete sql.NullBool `db:"to_delete"` }
NOTE: just making json []byte instead of pgtype.JSON
func RetrieveAllStaging ¶ added in v0.0.8
func RetrieveAllStaging() ([]StagingResource, error)
just in case we need to look at all records there
func RetrieveFilteredStagingDelete ¶ added in v0.0.13
func RetrieveFilteredStagingDelete(filter Filter, typeName string) ([]StagingResource, error)
func RetrieveInvalidStaging ¶
func RetrieveInvalidStaging(typeName string) ([]StagingResource, error)
func RetrieveSingleStaging ¶
func RetrieveSingleStaging(id string, typeName string) (StagingResource, error)
func RetrieveSingleStagingDelete ¶
func RetrieveSingleStagingDelete(id string, typeName string) (StagingResource, error)
func RetrieveSingleStagingValid ¶
func RetrieveSingleStagingValid(id string, typeName string) (StagingResource, error)
func RetrieveTypeStaging ¶
func RetrieveTypeStaging(typeName string) ([]StagingResource, error)
func RetrieveTypeStagingFiltered ¶ added in v0.0.6
func RetrieveTypeStagingFiltered(typeName string, filter Filter) ([]StagingResource, error)
func RetrieveValidStaging ¶
func RetrieveValidStaging(typeName string) ([]StagingResource, error)
func RetrieveValidStagingFiltered ¶ added in v0.0.6
func RetrieveValidStagingFiltered(typeName string, filter Filter) ([]StagingResource, error)
func ScanStaging ¶ added in v0.0.6
func ScanStaging(rows pgx.Rows) ([]StagingResource, error)
func (StagingResource) Identifier ¶
func (res StagingResource) Identifier() Identifier
kind of like dual primary key
type Storeable ¶
type Storeable interface { Identifier() Identifier Object() interface{} }
type Stub ¶
type Stub struct {
Id Identifier
}
func (Stub) Identifier ¶
func (s Stub) Identifier() Identifier