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 ClearMultipleDeletedFromStaging(items ...Identifiable) 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 Configure(conf Config)
- func DeleteFromStaging(res StagingResource) error
- func Difference(a, b []string) (diff []string)
- func DropResources() error
- func DropStaging() error
- func Eject(config OutakeConfig) 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 Inject(config IntakeConfig) error
- func IntakeInChunks(ins IntakeConfig) 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 OutakeConfig) 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 RemoveRecords(stubs ...Stub) 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 Scramjet(in IntakeConfig, process TrajectConfig, out OutakeConfig) error
- func ScramjetIntake(in IntakeConfig, process TrajectConfig) error
- func ScramjetOutake(out OutakeConfig) error
- func SetConfig(c *Config)
- func SetLogLevel(lvl LogLevel)
- func SetLogger(log Logger)
- func Shutdown()
- func StagingCount() int
- func StagingDeleteCount(typeName string) int
- func StagingResourceExists(id string, typeName string) bool
- func StagingTableExists() bool
- func StashStaging(docs ...Storeable) error
- func TimestampString() string
- func Traject(config TrajectConfig) error
- func TransferAll(typeName string, validator ValidatorFunc) error
- func TransferSubset(typeName string, filter Filter, validator ValidatorFunc) error
- type CompareOpt
- type Config
- type DatabaseInfo
- type DiffProcessConfig
- type ExistingListMaker
- type Filter
- type Identifiable
- type Identifier
- type IntakeConfig
- type IntakeListMaker
- type LogLevel
- type Logger
- type OutakeConfig
- type OutakeListMaker
- type Packet
- 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 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 TrajectConfig
- 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 ClearMultipleDeletedFromStaging ¶ added in v0.0.10
func ClearMultipleDeletedFromStaging(items ...Identifiable) error
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 Eject ¶ added in v0.0.10
func Eject(config OutakeConfig) 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 Inject ¶ added in v0.0.10
func Inject(config IntakeConfig) error
func IntakeInChunks ¶
func IntakeInChunks(ins IntakeConfig) 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 OutakeConfig) 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 RemoveRecords ¶ added in v0.0.10
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 Scramjet ¶ added in v0.0.10
func Scramjet(in IntakeConfig, process TrajectConfig, out OutakeConfig) error
func ScramjetIntake ¶ added in v0.0.10
func ScramjetIntake(in IntakeConfig, process TrajectConfig) error
func ScramjetOutake ¶ added in v0.0.10
func ScramjetOutake(out OutakeConfig) error
func SetLogLevel ¶ added in v0.0.10
func SetLogLevel(lvl LogLevel)
func StagingDeleteCount ¶
NOTE: only used in test - for verification
func StagingResourceExists ¶
returns false if error - maybe should not
func StashStaging ¶
func TimestampString ¶ added in v0.0.17
func TimestampString() string
func Traject ¶ added in v0.0.10
func Traject(config TrajectConfig) error
func TransferAll ¶ added in v0.0.10
func TransferAll(typeName string, validator ValidatorFunc) error
func TransferSubset ¶ added in v0.0.10
func TransferSubset(typeName string, filter Filter, validator ValidatorFunc) error
Types ¶
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 Config ¶
type Config struct { Database DatabaseInfo Logger *Logger LogLevel LogLevel }
more flexible?
var Cfg *Config
type DatabaseInfo ¶
type DiffProcessConfig ¶
type DiffProcessConfig struct { TypeName string ExistingListMaker ExistingListMaker ListMaker OutakeListMaker AllowDeleteAll bool }
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 IntakeConfig ¶ added in v0.0.10
type IntakeConfig struct { TypeName string ListMaker IntakeListMaker Count int ChunkSize int }
type IntakeListMaker ¶
the parameter (int) is 'offset'
type LogLevel ¶ added in v0.0.10
type LogLevel int
func GetLogLevel ¶ added in v0.0.10
func GetLogLevel() LogLevel
type OutakeConfig ¶ added in v0.0.10
type OutakeConfig struct { TypeName string ListMaker OutakeListMaker Filter *Filter }
type OutakeListMaker ¶
maybe interface instead of func type in struct?
type Packet ¶
type Packet struct { Id Identifier Obj interface{} // this will be serialized }
func MakePacket ¶ added in v0.0.10
func (Packet) Identifier ¶
func (p Packet) Identifier() Identifier
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 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
type TrajectConfig ¶ added in v0.0.10
type TrajectConfig struct { TypeName string Validator ValidatorFunc Filter *Filter }