database

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const LatestVersion = 3

The stub schema version

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, config *config.PostgresConfig) (*gorm.DB, error)

Connect setups connections to Postgres database

func Disconnect

func Disconnect(ctx context.Context, db *gorm.DB) error

Disconnect closes the connections to the MySQL database

func ExecuteFileScript

func ExecuteFileScript(ctx context.Context, db *gorm.DB, filePath string) error

ExecuteFileScript runs a specific migration file on a MySQL database using specific path

func Migrate

func Migrate(ctx context.Context, config *config.PostgresConfig, dir string) error

Types

type StubDBStore

type StubDBStore struct {
	// contains filtered or unexported fields
}

StubDBStore stores stub information to database

func NewStubDBStore

func NewStubDBStore(ctx context.Context, config *config.PostgresConfig) (*StubDBStore, error)

NewStubDBStore init a new instance for storage

func (*StubDBStore) Create

func (s *StubDBStore) Create(ctx context.Context, stubs ...*rio.Stub) error

Create creates a new stub

func (*StubDBStore) CreateIncomingRequest

func (s *StubDBStore) CreateIncomingRequest(ctx context.Context, r *rio.IncomingRequest) error

CreateIncomingRequest saves the income request

func (*StubDBStore) CreateProto

func (s *StubDBStore) CreateProto(ctx context.Context, protos ...*rio.Proto) error

CreateProto creates new protos

func (*StubDBStore) Delete

func (s *StubDBStore) Delete(ctx context.Context, id int64) error

Delete marks record as inactive

func (*StubDBStore) Find

func (s *StubDBStore) Find(ctx context.Context, id int64) (*rio.Stub, error)

Find finds by id

func (*StubDBStore) GetAll

func (s *StubDBStore) GetAll(ctx context.Context, namespace string) ([]*rio.Stub, error)

GetAll gets all saved records

func (*StubDBStore) GetIncomingRequests

func (s *StubDBStore) GetIncomingRequests(ctx context.Context, option *rio.IncomingQueryOption) ([]*rio.IncomingRequest, error)

GetIncomingRequests finds a income request by id

func (*StubDBStore) GetLastUpdatedProto

func (s *StubDBStore) GetLastUpdatedProto(ctx context.Context) (*rio.LastUpdatedRecord, error)

func (*StubDBStore) GetLastUpdatedStub

func (s *StubDBStore) GetLastUpdatedStub(ctx context.Context, namespace string) (*rio.LastUpdatedRecord, error)

func (*StubDBStore) GetProtos

func (s *StubDBStore) GetProtos(ctx context.Context) ([]*rio.Proto, error)

GetProtos gets a list of protos

func (*StubDBStore) Reset

func (s *StubDBStore) Reset(ctx context.Context, option *rio.ResetQueryOption) error

Reset clear data

Jump to

Keyboard shortcuts

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