library

package
v0.0.0-...-53cb395 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Library

type Library struct {
	DBUrl string
	Name  string
	Owner string

	Pool *pgxpool.Pool
}

func NewFromDB

func NewFromDB(ctx context.Context, dbURL string) (*Library, error)

NewFromDB creates a new library object with values from the database

func (*Library) Close

func (myLibrary *Library) Close()

Close the database pool

func (*Library) Connect

func (myLibrary *Library) Connect(ctx context.Context) error

Connect to the database configured for the library

func (*Library) LastUpdated

func (myLibrary *Library) LastUpdated(ctx context.Context) (time.Time, error)

LastUpdated returns the date that the database was last updated

func (*Library) NumSubscriptions

func (myLibrary *Library) NumSubscriptions(ctx context.Context) (int, error)

NumSubscriptions returns the total count of subscriptions configured in the database

func (*Library) SaveDB

func (myLibrary *Library) SaveDB(ctx context.Context) error

SaveDB creates a new record in the library table for this library

func (*Library) SaveObservations

func (myLibrary *Library) SaveObservations(queue <-chan *data.Observation, wg *sync.WaitGroup)

SaveObservations continuously reads from the input queue

func (*Library) SubscriptionFromID

func (myLibrary *Library) SubscriptionFromID(ctx context.Context, id string) (*Subscription, error)

SubscriptionFromID fetches a subscription from the library with the given ID

func (*Library) Subscriptions

func (myLibrary *Library) Subscriptions(ctx context.Context) ([]*Subscription, error)

Subscriptions returns an array of subscription objects

func (*Library) Summary

func (myLibrary *Library) Summary(ctx context.Context) (string, error)

Summary returns a description of the library in markdown

func (*Library) TotalRecords

func (myLibrary *Library) TotalRecords(ctx context.Context) (int, error)

TotalRecords returns the total number of records in the library

func (*Library) TotalSecurities

func (myLibrary *Library) TotalSecurities(ctx context.Context) (int, error)

TotalSecurities returns the total number of securities in the library

type Subscription

type Subscription struct {
	ID   uuid.UUID
	Name string

	Provider string
	Dataset  string
	Config   map[string]string

	DataTables    []string
	DataTypes     []string
	DataTablesMap map[string]string
	IsPartitioned bool

	TotalRecords         int64
	NumRecordsLastImport int64

	TotalSecurities         int64
	NumSecuritiesLastImport int64

	FirstObsDate time.Time
	LastObsDate  time.Time

	Schedule      string
	HealthCheckID string
	LastRun       time.Time
	Active        bool
	SchemaVersion int

	CreatedOn time.Time
	CreatedBy string

	Library *Library
}

func (*Subscription) Activate

func (subscription *Subscription) Activate(ctx context.Context) error

Activate the subscription

func (*Subscription) ComputeTableNames

func (subscription *Subscription) ComputeTableNames()

Compute table names based on subscription data types

func (*Subscription) Deactivate

func (subscription *Subscription) Deactivate(ctx context.Context) error

Deactivate the subscription; all data is still saved in the database but the subscription is marked as inactive and it won't show up in reports

func (*Subscription) Delete

func (subscription *Subscription) Delete(ctx context.Context) error

Delete the subscription from database along with all associated tables

func (*Subscription) ManagePartitions

func (subscription *Subscription) ManagePartitions(ctx context.Context) error

ManagePartitions creates any new partitions needed for the subscription

func (*Subscription) PartitionTables

func (subscription *Subscription) PartitionTables() []string

PartitionTables returns the table names for all paritions in the set

func (*Subscription) Save

func (subscription *Subscription) Save(ctx context.Context) error

Save the subscription to the database

Jump to

Keyboard shortcuts

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