database

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultPostgreSQLReadRole      = "read"
	DefaultPostgreSQLReadWriteRole = "readWrite"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AtlasOptions

type AtlasOptions struct {
	GroupID    string
	PublicKey  string
	PrivateKey string
}

type AtlasRepository

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

func NewAtlasRepository

func NewAtlasRepository(ctx context.Context, opts AtlasOptions) (*AtlasRepository, error)

func (*AtlasRepository) Close

func (m *AtlasRepository) Close(ctx context.Context) error

func (*AtlasRepository) DropUser

func (m *AtlasRepository) DropUser(ctx context.Context, database string, username string) error

func (*AtlasRepository) SetupUser

func (m *AtlasRepository) SetupUser(ctx context.Context, database string, username string, password string, roles MongoDBRoles) error

type Grant added in v0.2.0

type Grant struct {
	Object     string
	ObjectName string
	User       string
	Privileges []Privilege
}

type MongoDBOptions

type MongoDBOptions struct {
	URI              string
	DatabaseName     string
	AuthDatabaseName string
	Username         string
	Password         string
}

type MongoDBRepository

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

func NewMongoDBRepository

func NewMongoDBRepository(ctx context.Context, opts MongoDBOptions) (*MongoDBRepository, error)

func (*MongoDBRepository) Close

func (m *MongoDBRepository) Close(ctx context.Context) error

func (*MongoDBRepository) DropUser

func (m *MongoDBRepository) DropUser(ctx context.Context, database string, username string) error

func (*MongoDBRepository) SetupUser

func (m *MongoDBRepository) SetupUser(ctx context.Context, database string, username string, password string, roles MongoDBRoles) error

type MongoDBRole

type MongoDBRole struct {
	Name string `json:"role" bson:"role"`
	DB   string `json:"db" bson:"db"`
}

type MongoDBRoles

type MongoDBRoles []MongoDBRole

type MongoDBUser

type MongoDBUser struct {
	User  string       `json:"user" bson:"user"`
	DB    string       `json:"db" bson:"db"`
	Roles MongoDBRoles `json:"roles" bson:"roles"`
}

type MongoDBUsers

type MongoDBUsers []MongoDBUser

type PostgreSQLOptions

type PostgreSQLOptions struct {
	URI          string
	DatabaseName string
	Username     string
	Password     string
}

type PostgreSQLRepository

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

func NewPostgreSQLRepository

func NewPostgreSQLRepository(ctx context.Context, opts PostgreSQLOptions) (*PostgreSQLRepository, error)

func (*PostgreSQLRepository) Close

func (s *PostgreSQLRepository) Close(ctx context.Context) error

func (*PostgreSQLRepository) CreateDatabaseIfNotExists

func (s *PostgreSQLRepository) CreateDatabaseIfNotExists(ctx context.Context, database string) error

TODO Prepared Statements

func (*PostgreSQLRepository) DropUser

func (s *PostgreSQLRepository) DropUser(ctx context.Context, user PostgresqlUser) error

func (*PostgreSQLRepository) EnableExtension

func (s *PostgreSQLRepository) EnableExtension(ctx context.Context, db, name string) error

func (*PostgreSQLRepository) RevokeAllPrivileges

func (s *PostgreSQLRepository) RevokeAllPrivileges(ctx context.Context, user PostgresqlUser) error

func (*PostgreSQLRepository) SetupUser

func (s *PostgreSQLRepository) SetupUser(ctx context.Context, user PostgresqlUser) error

type PostgresqlUser added in v0.2.0

type PostgresqlUser struct {
	Database string
	Username string
	Password string
	Roles    []string
	Grants   []Grant
}

type Privilege added in v0.2.0

type Privilege string
var AlPrivilege Privilege = "ALL"
var SelectPrivilege Privilege = "SELECT"

Jump to

Keyboard shortcuts

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