Documentation
¶
Overview ¶
Copyright 2022 The Gidari PG Authors.
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\n
Copyright 2022 The Gidari PG Authors.
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\n
Copyright 2022 The Gidari PG Authors.
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\n
Copyright 2022 The Gidari PG Authors.
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\n
Copyright 2022 The Gidari PG Authors.
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\n
Copyright 2022 The Gidari PG Authors.
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\n
Index ¶
- Constants
- Variables
- func New(ctx context.Context, connectionURL string) (proto.Storage, error)
- type Postgres
- func (pg *Postgres) Close()
- func (pg *Postgres) IsNoSQL() bool
- func (pg *Postgres) ListColumns(ctx context.Context) (*proto.ListColumnsResponse, error)
- func (pg *Postgres) ListPrimaryKeys(ctx context.Context) (*proto.ListPrimaryKeysResponse, error)
- func (pg *Postgres) ListTables(ctx context.Context) (*proto.ListTablesResponse, error)
- func (pg *Postgres) StartTx(ctx context.Context) (*proto.Txn, error)
- func (pg *Postgres) Truncate(ctx context.Context, req *proto.TruncateRequest) (*proto.TruncateResponse, error)
- func (pg *Postgres) Type() uint8
- func (pg *Postgres) Upsert(ctx context.Context, req *proto.UpsertRequest) (*proto.UpsertResponse, error)
Constants ¶
const Version = "0.0.0-alpha"
Variables ¶
var ( ErrTransactionNotFound = fmt.Errorf("transaction not found") ErrNoTables = fmt.Errorf("no tables found") ErrUnsupportedDataType = fmt.Errorf("unsupported data type") ErrFailedToMarshalJSON = fmt.Errorf("failed to marshal json") ErrFailedToUnmarshalJSON = fmt.Errorf("failed to unmarshal json") )
Functions ¶
Types ¶
type Postgres ¶
Postgres is a wrapper around the sql.DB object.
func (*Postgres) Close ¶
func (pg *Postgres) Close()
Close will close the underlying database / transaction.
func (*Postgres) IsNoSQL ¶
IsNoSQL returns "false" to indicate that "Postgres" is not a NoSQL database.
func (*Postgres) ListColumns ¶
ListColumns will set a complete list of available columns per table on the response.
func (*Postgres) ListPrimaryKeys ¶
ListPrimaryKeys will list all primary keys for all of the tables in the database defined by the DNS used to create the postgres instance.
func (*Postgres) ListTables ¶
ListTables will set a complete list of available tables on the response.
func (*Postgres) StartTx ¶
StartTx will start a transaction on the Postgres connection. The transaction ID is returned and should be used to commit or rollback the transaction.
func (*Postgres) Truncate ¶
func (pg *Postgres) Truncate(ctx context.Context, req *proto.TruncateRequest) (*proto.TruncateResponse, error)
Truncate will truncate a table.
func (*Postgres) Upsert ¶
func (pg *Postgres) Upsert(ctx context.Context, req *proto.UpsertRequest) (*proto.UpsertResponse, error)
Upsert will insert the records on the request if they do not exist in the database. On conflict, it will use the PK on the request record to update the data in the database. An upsert request will update the entire table for a given record, include fields that have not been set directly.