pgsql

package
v0.0.0-...-2c8e3b4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	Pool *pgxpool.Pool
}

func OpenConnection

func OpenConnection(url string) (*Db, error)

func (*Db) AddCommand

func (db *Db) AddCommand(botId int64, m *model.Command) (int64, error)

func (*Db) AddCommandTx

func (db *Db) AddCommandTx(ctx context.Context, tx pgx.Tx, botId int64, m *model.Command) (int64, error)

func (*Db) AddComponent

func (db *Db) AddComponent(botId int64, groupId int64, m *model.Component) (int64, error)
			id bigserial NOT NULL,
           type VARCHAR(20),
           component_id BIGINT NOT NULL UNIQUE,
           next_id BIGINT,
           path text NOT NULL DEFAULT '''',
           position POINT,
           group_id BIGINT,
           PRIMARY KEY (id),
           FOREIGN KEY(group_id)

func (*Db) AddConnection

func (db *Db) AddConnection(botId int64, groupId int64, m *model.Connection) error

func (*Db) AddUser

func (db *Db) AddUser(botId int64, m *model.User) (int64, error)

func (*Db) BeginTx

func (db *Db) BeginTx(ctx context.Context) (pgx.Tx, error)

func (*Db) CheckBotExist

func (db *Db) CheckBotExist(userId int64, botId int64) (bool, error)

func (*Db) CheckBotTokenExist

func (db *Db) CheckBotTokenExist(token *string) (bool, error)

func (*Db) CheckCommandExist

func (db *Db) CheckCommandExist(botId int64, compId int64, commandId int64) (bool, error)

func (*Db) CheckComponentExist

func (db *Db) CheckComponentExist(botId int64, groupId int64, compId int64) (bool, error)

func (*Db) CheckGroupExist

func (db *Db) CheckGroupExist(botId int64, groupId int64) (bool, error)

func (*Db) CheckUserExistByTgId

func (db *Db) CheckUserExistByTgId(botId int64, tgId int64) (bool, error)

func (*Db) CloseConnection

func (db *Db) CloseConnection()

func (*Db) CreateBot

func (db *Db) CreateBot(m *model.Bot, mc *model.Component) (botId int64, componentId int64, err error)

func (*Db) DelAllCommands

func (db *Db) DelAllCommands(botId int64) error

func (*Db) DelCommand

func (db *Db) DelCommand(botId int64, commandId int64) error

func (*Db) DelCommandsByCompIdTx

func (db *Db) DelCommandsByCompIdTx(ctx context.Context, tx pgx.Tx, botId int64, compId int64) error

func (*Db) DelNextStepCommand

func (db *Db) DelNextStepCommand(botId int64, commandId int64) error

func (*Db) DeleteBot

func (db *Db) DeleteBot(userId int64, botId int64) error

func (*Db) DeleteComponent

func (db *Db) DeleteComponent(botId int64, groupId int64, componentId int64) error

func (*Db) DeleteConnection

func (db *Db) DeleteConnection(botId int64, groupId int64, m *model.SourceConnectionPoint, targetComponentId int64) error

func (*Db) GetBotStatus

func (db *Db) GetBotStatus(botId int64, userId int64) (model.BotStatus, error)

func (*Db) GetBotToken

func (db *Db) GetBotToken(userId int64, botId int64) (*string, error)

func (*Db) GetComponentType

func (db *Db) GetComponentType(botId int64, groupId int64, componentId int64) (string, error)

func (*Db) GetComponents

func (db *Db) GetComponents(botId int64, groupId int64) ([]*model.Component, error)

func (*Db) GetCountCommandsInComponent

func (db *Db) GetCountCommandsInComponent(botId int64, compId int64) (int64, error)

func (*Db) GetTargetComponentId

func (db *Db) GetTargetComponentId(botId int64, groupId int64, m *model.SourceConnectionPoint) (*int64, error)

func (*Db) SetBotStatus

func (db *Db) SetBotStatus(botId int64, userId int64, status model.BotStatus) error

func (*Db) SetBotToken

func (db *Db) SetBotToken(userId int64, botId int64, token *string) error

func (*Db) SetComponentPosition

func (db *Db) SetComponentPosition(botId int64, groupId int64, componentId int64, position *model.Point) error

func (*Db) SetNextStepCommand

func (db *Db) SetNextStepCommand(botId int64, commandId int64, nextStepId int64) error

func (*Db) SetUserStepByTgId

func (db *Db) SetUserStepByTgId(botId int64, userId int64, stepID int64) error

func (*Db) UpdCommand

func (db *Db) UpdCommand(botId int64, commandId int64, t *string, data *string) error

func (*Db) UpdateComponentData

func (db *Db) UpdateComponentData(botId int64, groupId int64, componentId int64, data map[string]any) error

func (*Db) UpdateComponentPath

func (db *Db) UpdateComponentPath(botId int64, groupId int64, componentId int64, path string) error

func (*Db) UserBots

func (db *Db) UserBots(userId int64) (*[]*model.Bot, error)

func (*Db) UserStepByTgId

func (db *Db) UserStepByTgId(botId int64, userId int64) (int64, error)

Jump to

Keyboard shortcuts

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