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 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 ClearResourceType(typeName string) error
- func ClearStagingType(typeName string) error
- func ClearStagingTypeDeletes(typeName string) error
- func ClearStagingTypeValid(typeName string) 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)
- 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 ProcessOutake(proc OutakeProcessConfig) error
- func ProcessSingleStaging(item Identifiable, validator ValidatorFunc) error
- func ProcessTypeStaging(typeName string, validator ValidatorFunc) error
- func RemoveStagingDeletedFromResources(id string, 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 StagingDeleteCount(typeName string) int
- func StagingResourceExists(id string, typeName string) bool
- func StagingTableExists() bool
- func StashStaging(docs ...Storeable) error
- type ChunkableIntakeConfig
- type Config
- type DatabaseInfo
- type DeleteChecker
- type DiffProcessConfig
- type ExistingListMaker
- type Identifiable
- type Identifier
- type IntakeListMaker
- type JustTestingInspector
- type OutakeListMaker
- type OutakeProcessConfig
- type Packet
- type ProgressChecker
- type Resource
- type StagingResource
- func RetrieveInvalidStaging(typeName string) []StagingResource
- 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
- func RetrieveValidStaging(typeName string) []StagingResource
- type Storeable
- type Stub
- 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 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 ClearResourceType ¶
func ClearStagingType ¶
call where valid = true? (after transfering to resources)
func ClearStagingTypeDeletes ¶
func ClearStagingTypeValid ¶
leave the is_valid = false for investigation
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)
NOTE: this needs a 'typeName' param because it assumes validator is different per type
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 ProcessOutake ¶
func ProcessOutake(proc OutakeProcessConfig) error
func ProcessSingleStaging ¶
func ProcessSingleStaging(item Identifiable, validator ValidatorFunc) error
func ProcessTypeStaging ¶
func ProcessTypeStaging(typeName string, validator ValidatorFunc) error
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 DatabaseInfo ¶
type DeleteChecker ¶
type DeleteChecker func([]string)
type DiffProcessConfig ¶
type DiffProcessConfig struct { TypeName string ExistingListMaker ExistingListMaker ListMaker OutakeListMaker JustTest bool }
to look for diffs for duid (for instance) both lists have to be sent in
type ExistingListMaker ¶
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 }
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 RetrieveTypeResources ¶
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 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 RetrieveInvalidStaging ¶
func RetrieveInvalidStaging(typeName string) []StagingResource
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 RetrieveValidStaging ¶
func RetrieveValidStaging(typeName string) []StagingResource
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