Documentation ¶
Overview ¶
Package pq implements the github.com/neuronlabs/neuron-core repository with the modular filter with the support. The package uses github.com/jackc/pgx Postgres driver.
Index ¶
- Constants
- Variables
- type Factory
- type Repository
- func (r *Repository) Begin(ctx context.Context, s *query.Scope) error
- func (p *Repository) Close(ctx context.Context) error
- func (r *Repository) Commit(ctx context.Context, s *query.Scope) error
- func (p *Repository) Count(ctx context.Context, s *query.Scope) (int64, error)
- func (p *Repository) Create(ctx context.Context, s *query.Scope) error
- func (p *Repository) Delete(ctx context.Context, s *query.Scope) error
- func (p *Repository) FactoryName() string
- func (p *Repository) Get(ctx context.Context, s *query.Scope) error
- func (p *Repository) List(ctx context.Context, s *query.Scope) error
- func (p *Repository) Patch(ctx context.Context, s *query.Scope) error
- func (r *Repository) Rollback(ctx context.Context, s *query.Scope) error
Constants ¶
const (
// AutoMigrateKey is the key in the Repository.Options used to get the automigrate option for the whole repository
AutoMigrateKey = "automigrate"
)
const FactoryName = "pq"
FactoryName defines the name of the factory.
Variables ¶
var AutomigrateAll bool
AutomigrateAll defines if all the models should be automigrated.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is the pq.Repository factory.
func (*Factory) Close ¶ added in v0.1.2
Close closes the connected repositories for given factory type Implements repository.Factory interface.
func (*Factory) DriverName ¶ added in v0.2.1
DriverName gets the Factory repository name. Implements repository.Repository interface.
func (*Factory) New ¶
func (f *Factory) New(c repository.Controller, m *mapping.ModelStruct) (repository.Repository, error)
New creates new PQ repository for the provided model.
type Repository ¶
type Repository struct { // is the sql connection Pool *pgx.ConnPool // config for the postgis Config pgx.ConnPoolConfig // PostgresVersion is the numerical version of the postgres server. PostgresVersion int // contains filtered or unexported fields }
Repository is the postgis repository that is used to query the postgis database Implements query.FullRepository
func (*Repository) Begin ¶
Begin starts a transaction for the given scope. Implements Begin method of the query.Transactioner interface.
func (*Repository) Close ¶ added in v0.1.2
func (p *Repository) Close(ctx context.Context) error
Close closes the repository connections
func (*Repository) Commit ¶
Commit commits the scope's transaction Implements Commit method from the query.Commiter interface
func (*Repository) Create ¶
Create creates the value within the query. Implements repository.Creator interface.
func (*Repository) Delete ¶
Delete deletes all the values that matches scope's filters. Implements query.Deleter interface.
func (*Repository) FactoryName ¶ added in v0.4.0
func (p *Repository) FactoryName() string
FactoryName returns the name of the factory for this Repository. Implements RepositoryNamer interface.
func (*Repository) Get ¶
Get gets the query scope's single value. Implements query.Getter interface.
func (*Repository) List ¶
List lists all the values that matches scope's filters, sorts and pagination. Implements query.Lister interface.