relation_manager_postgres

package
v0.0.2 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: 11 Imported by: 0

README

RelationManagerPostgres

The RelationManagerPostgres is the Bursary RelationManager implementation based on the PostgreSQL database system.

Documentation

Index

Constants

View Source
const RootNode = "00000000-0000-0000-0000-000000000000"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelRules

type ChannelRules map[string]*Rule

func (*ChannelRules) Scan

func (cr *ChannelRules) Scan(src interface{}) error

func (ChannelRules) Value

func (cr ChannelRules) Value() (driver.Value, error)

type MemberRecord

type MemberRecord struct {
	ID           string         `db:"id"`
	ChannelRules ChannelRules   `db:"channel_rules"`
	RelationPath pq.StringArray `db:"relation_path"`
	Upstream     string         `db:"upstream"`
	CreatedAt    time.Time      `db:"created_at"`
}

func (*MemberRecord) ToMemberObject

func (mr *MemberRecord) ToMemberObject() *bursary.Member

type Opt

type Opt func(*RelationManagerPostgres)

func WithDb

func WithDb(db *sqlx.DB) Opt

func WithTableName

func WithTableName(tableName string) Opt

type RelationManagerPostgres

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

func NewRelationManagerPostgres

func NewRelationManagerPostgres(opts ...Opt) *RelationManagerPostgres

func (*RelationManagerPostgres) AddMembers

func (rm *RelationManagerPostgres) AddMembers(members []*bursary.MemberEntry, upstream string) error

func (*RelationManagerPostgres) ChangePath

func (rm *RelationManagerPostgres) ChangePath(mid string, newPath []string) error

func (*RelationManagerPostgres) ChangePathByUpstream

func (rm *RelationManagerPostgres) ChangePathByUpstream(upstream string, newPath []string) error

func (*RelationManagerPostgres) Close

func (rm *RelationManagerPostgres) Close() error

func (*RelationManagerPostgres) DeleteMembers

func (rm *RelationManagerPostgres) DeleteMembers(mids []string) error

func (*RelationManagerPostgres) GetMember

func (rm *RelationManagerPostgres) GetMember(mid string) (*bursary.Member, error)

func (*RelationManagerPostgres) GetPath

func (rm *RelationManagerPostgres) GetPath(mid string) ([]string, error)

func (*RelationManagerPostgres) GetUpstreams

func (rm *RelationManagerPostgres) GetUpstreams(mid string) ([]*bursary.Member, error)

func (*RelationManagerPostgres) Init

func (rm *RelationManagerPostgres) Init() error

func (*RelationManagerPostgres) ListMembers

func (rm *RelationManagerPostgres) ListMembers(upstream string, cond *bursary.Condition) ([]*bursary.Member, error)

func (*RelationManagerPostgres) MoveMembers

func (rm *RelationManagerPostgres) MoveMembers(mids []string, upstream string) error

func (*RelationManagerPostgres) RemoveChannel

func (rm *RelationManagerPostgres) RemoveChannel(channel string) error

func (*RelationManagerPostgres) RemoveChannelRule

func (rm *RelationManagerPostgres) RemoveChannelRule(mid string, channel string) error

func (*RelationManagerPostgres) UpdateChannelRule

func (rm *RelationManagerPostgres) UpdateChannelRule(mid string, channel string, rule *bursary.Rule) error

type Rule

type Rule struct {
	Commission float64 `json:"commission"`
	Share      float64 `json:"share"`
}

Jump to

Keyboard shortcuts

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