Help us shape the future of Go! Take the 2026 Go Developer Survey

database

package
v1.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoDNS   = "dns"
	ProtoHTTP  = "http"
	ProtoHTTPS = "https"
	ProtoSMTP  = "smtp"
	ProtoFTP   = "ftp"

	ProtoCategoryDNS  = "dns"
	ProtoCategoryHTTP = "http"
	ProtoCategorySMTP = "smtp"
	ProtoCategoryFTP  = "ftp"
)
View Source
const HTTPMethodAny = "ANY"

Variables

View Source
var DNSStrategiesAll = func() []string {
	vals := AllDNSStrategyValues()
	res := make([]string, len(vals))
	for i, v := range vals {
		res[i] = string(v)
	}
	return res
}()

TODO: cleanup

View Source
var DNSTypesAll = func() []string {
	vals := AllDNSRecordTypeValues()
	res := make([]string, len(vals))
	for i, v := range vals {
		res[i] = string(v)
	}
	return res
}()

TODO: cleanup

View Source
var ErrNoRows = pgx.ErrNoRows

Functions

func Migrate

func Migrate(dsn string) (uint, error)

func ProtoCategoryContains

func ProtoCategoryContains(protocols []string, category string) bool

func ProtoToCategory

func ProtoToCategory(proto string) string

func RunInTx

func RunInTx[T any](
	ctx context.Context,
	db *DB,
	fn func(ctx context.Context, db Querier) (*T, error),
) (*T, error)

Types

type AuditActorMetadata

type AuditActorMetadata = map[string]any

type AuditRecord

type AuditRecord struct {
	ID            int64                   `db:"id"`
	UUID          uuid.UUID               `db:"uuid"`
	CreatedAt     time.Time               `db:"created_at"`
	Action        AuditRecordActionType   `db:"action"`
	ResourceType  AuditRecordResourceType `db:"resource_type"`
	Source        AuditRecordSourceType   `db:"source"`
	ActorID       *int64                  `db:"actor_id"`
	ActorName     string                  `db:"actor_name"`
	ActorMetadata AuditActorMetadata      `db:"actor_metadata"`
	Resource      AuditResource           `db:"resource"`
}

type AuditRecordActionType

type AuditRecordActionType string
const (
	AuditRecordActionTypeCreate AuditRecordActionType = "create"
	AuditRecordActionTypeUpdate AuditRecordActionType = "update"
	AuditRecordActionTypeDelete AuditRecordActionType = "delete"
)

func AllAuditRecordActionTypeValues

func AllAuditRecordActionTypeValues() []AuditRecordActionType

func (*AuditRecordActionType) Scan

func (e *AuditRecordActionType) Scan(src interface{}) error

type AuditRecordResourceType

type AuditRecordResourceType string
const (
	AuditRecordResourceTypePayload   AuditRecordResourceType = "payload"
	AuditRecordResourceTypeUser      AuditRecordResourceType = "user"
	AuditRecordResourceTypeDNSRecord AuditRecordResourceType = "dns_record"
	AuditRecordResourceTypeHTTPRoute AuditRecordResourceType = "http_route"
)

func AllAuditRecordResourceTypeValues

func AllAuditRecordResourceTypeValues() []AuditRecordResourceType

func (*AuditRecordResourceType) Scan

func (e *AuditRecordResourceType) Scan(src interface{}) error

type AuditRecordSourceType

type AuditRecordSourceType string
const (
	AuditRecordSourceTypeAPI      AuditRecordSourceType = "api"
	AuditRecordSourceTypeTelegram AuditRecordSourceType = "telegram"
	AuditRecordSourceTypeLark     AuditRecordSourceType = "lark"
	AuditRecordSourceTypeSlack    AuditRecordSourceType = "slack"
)

func AllAuditRecordSourceTypeValues

func AllAuditRecordSourceTypeValues() []AuditRecordSourceType

func (*AuditRecordSourceType) Scan

func (e *AuditRecordSourceType) Scan(src interface{}) error

type AuditRecordsCreateParams

type AuditRecordsCreateParams struct {
	Action        AuditRecordActionType   `db:"action"`
	ResourceType  AuditRecordResourceType `db:"resource_type"`
	Source        AuditRecordSourceType   `db:"source"`
	ActorID       *int64                  `db:"actor_id"`
	ActorName     string                  `db:"actor_name"`
	ActorMetadata AuditActorMetadata      `db:"actor_metadata"`
	Resource      AuditResource           `db:"resource"`
}

type AuditRecordsListParams

type AuditRecordsListParams struct {
	ActorID      *int64     `db:"actor_id"`
	ActorName    string     `db:"actor_name"`
	ResourceType string     `db:"resource_type"`
	Action       string     `db:"action"`
	FromAt       *time.Time `db:"from_at"`
	ToAt         *time.Time `db:"to_at"`
	PageOffset   int64      `db:"page_offset"`
	PageLimit    int64      `db:"page_limit"`
}

type AuditResource

type AuditResource = json.RawMessage

type DB

type DB struct {
	*Queries
	// contains filtered or unexported fields
}

func NewWithDSN

func NewWithDSN(dsn string) (*DB, error)

func (DB) DB

func (db DB) DB() *sql.DB

func (*DB) RunInTx

func (db *DB) RunInTx(ctx context.Context, fn txFunc) error

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DNSRecord

type DNSRecord struct {
	ID             *int64        `db:"id"`
	PayloadID      int64         `db:"payload_id"`
	Name           string        `db:"name"`
	Type           DNSRecordType `db:"type"`
	TTL            int           `db:"ttl"`
	Values         []string      `db:"values"`
	Strategy       DNSStrategy   `db:"strategy"`
	LastAnswer     []string      `db:"last_answer"`
	LastAccessedAt *time.Time    `db:"last_accessed_at"`
	CreatedAt      time.Time     `db:"created_at"`
	Index          int           `db:"index"`
}

func (DNSRecord) Qtype

func (r DNSRecord) Qtype() uint16

Qtype maps the DNSRecord's Type to a dns.Type uint16 value.

type DNSRecordType

type DNSRecordType string
const (
	DNSRecordTypeA     DNSRecordType = "A"
	DNSRecordTypeAAAA  DNSRecordType = "AAAA"
	DNSRecordTypeMX    DNSRecordType = "MX"
	DNSRecordTypeTXT   DNSRecordType = "TXT"
	DNSRecordTypeCNAME DNSRecordType = "CNAME"
	DNSRecordTypeNS    DNSRecordType = "NS"
	DNSRecordTypeCAA   DNSRecordType = "CAA"
)

func AllDNSRecordTypeValues

func AllDNSRecordTypeValues() []DNSRecordType

func (*DNSRecordType) Scan

func (e *DNSRecordType) Scan(src interface{}) error

type DNSRecordsCreateParams

type DNSRecordsCreateParams struct {
	PayloadID      int64         `db:"payload_id"`
	Name           string        `db:"name"`
	Type           DNSRecordType `db:"type"`
	TTL            int           `db:"ttl"`
	Values         []string      `db:"values"`
	Strategy       DNSStrategy   `db:"strategy"`
	LastAnswer     []string      `db:"last_answer"`
	LastAccessedAt *time.Time    `db:"last_accessed_at"`
}

type DNSRecordsGetByPayloadNameAndTypeParams

type DNSRecordsGetByPayloadNameAndTypeParams struct {
	PayloadID int64         `db:"payload_id"`
	Name      string        `db:"name"`
	Type      DNSRecordType `db:"type"`
}

type DNSRecordsUpdateParams

type DNSRecordsUpdateParams struct {
	ID             *int64        `db:"id"`
	PayloadID      int64         `db:"payload_id"`
	Name           string        `db:"name"`
	Type           DNSRecordType `db:"type"`
	TTL            int           `db:"ttl"`
	Values         []string      `db:"values"`
	Strategy       DNSStrategy   `db:"strategy"`
	LastAnswer     []string      `db:"last_answer"`
	LastAccessedAt *time.Time    `db:"last_accessed_at"`
}

type DNSStrategy

type DNSStrategy string
const (
	DNSStrategyAll        DNSStrategy = "all"
	DNSStrategyRoundRobin DNSStrategy = "round-robin"
	DNSStrategyRebind     DNSStrategy = "rebind"
)

func AllDNSStrategyValues

func AllDNSStrategyValues() []DNSStrategy

func (*DNSStrategy) Scan

func (e *DNSStrategy) Scan(src interface{}) error

type Event

type Event struct {
	ID         int64      `db:"id"`
	PayloadID  int64      `db:"payload_id"`
	Protocol   string     `db:"protocol"`
	Meta       EventsMeta `db:"meta"`
	RemoteAddr string     `db:"remote_addr"`
	ReceivedAt time.Time  `db:"received_at"`
	CreatedAt  time.Time  `db:"created_at"`
	UUID       uuid.UUID  `db:"uuid"`
	Data       [][]byte   `db:"data"`
}

type EventsCreateParams

type EventsCreateParams struct {
	UUID       uuid.UUID  `db:"uuid"`
	PayloadID  int64      `db:"payload_id"`
	Protocol   string     `db:"protocol"`
	Data       [][]byte   `db:"data"`
	Meta       EventsMeta `db:"meta"`
	RemoteAddr string     `db:"remote_addr"`
	ReceivedAt time.Time  `db:"received_at"`
}

type EventsGetByPayloadAndIndexRow

type EventsGetByPayloadAndIndexRow struct {
	Event Event `db:"event"`
	Index int64 `db:"index"`
}

type EventsListByPayloadIDParams

type EventsListByPayloadIDParams struct {
	PayloadID int64 `db:"payload_id"`
	Limit     int64 `db:"limit"`
	Offset    int64 `db:"offset"`
}

type EventsListByPayloadIDRow

type EventsListByPayloadIDRow struct {
	Event Event `db:"event"`
	Index int64 `db:"index"`
}

type EventsMeta

type EventsMeta struct {
	// Protocol-specific metadata (only one is populated per event)
	DNS  *dnsx.Meta  `json:"dns,omitempty"`
	HTTP *httpx.Meta `json:"http,omitempty"`
	SMTP *smtpx.Meta `json:"smtp,omitempty"`
	FTP  *ftpx.Meta  `json:"ftp,omitempty"`

	// Common fields across protocols
	Secure bool `json:"secure,omitempty"`

	// GeoIP information (populated by event handler for all protocols)
	GeoIP *geoipx.Meta `json:"geoip,omitempty"`
}

EventsMeta contains protocol-specific event metadata. Only one of the protocol-specific fields will be populated per event.

type HTTPHeaders

type HTTPHeaders = map[string][]string

type HTTPRoute

type HTTPRoute struct {
	ID        int64       `db:"id"`
	PayloadID int64       `db:"payload_id"`
	Method    string      `db:"method"`
	Path      string      `db:"path"`
	Code      int         `db:"code"`
	Headers   HTTPHeaders `db:"headers"`
	Body      []byte      `db:"body"`
	IsDynamic bool        `db:"is_dynamic"`
	CreatedAt time.Time   `db:"created_at"`
	Index     int         `db:"index"`
}

type HTTPRoutesCreateParams

type HTTPRoutesCreateParams struct {
	PayloadID int64       `db:"payload_id"`
	Method    string      `db:"method"`
	Path      string      `db:"path"`
	Code      int         `db:"code"`
	Headers   HTTPHeaders `db:"headers"`
	Body      []byte      `db:"body"`
	IsDynamic bool        `db:"is_dynamic"`
}

type HTTPRoutesGetByPayloadMethodAndPathParams

type HTTPRoutesGetByPayloadMethodAndPathParams struct {
	PayloadID int64  `db:"payload_id"`
	Method    string `db:"method"`
	Path      string `db:"path"`
}

type HTTPRoutesUpdateParams

type HTTPRoutesUpdateParams struct {
	ID        int64       `db:"id"`
	PayloadID int64       `db:"payload_id"`
	Method    string      `db:"method"`
	Path      string      `db:"path"`
	Code      int         `db:"code"`
	Headers   HTTPHeaders `db:"headers"`
	Body      []byte      `db:"body"`
	IsDynamic bool        `db:"is_dynamic"`
}

type NullAuditRecordActionType

type NullAuditRecordActionType struct {
	AuditRecordActionType AuditRecordActionType
	Valid                 bool // Valid is true if AuditRecordActionType is not NULL
}

func (*NullAuditRecordActionType) Scan

func (ns *NullAuditRecordActionType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuditRecordActionType) Value

Value implements the driver Valuer interface.

type NullAuditRecordResourceType

type NullAuditRecordResourceType struct {
	AuditRecordResourceType AuditRecordResourceType
	Valid                   bool // Valid is true if AuditRecordResourceType is not NULL
}

func (*NullAuditRecordResourceType) Scan

func (ns *NullAuditRecordResourceType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuditRecordResourceType) Value

Value implements the driver Valuer interface.

type NullAuditRecordSourceType

type NullAuditRecordSourceType struct {
	AuditRecordSourceType AuditRecordSourceType
	Valid                 bool // Valid is true if AuditRecordSourceType is not NULL
}

func (*NullAuditRecordSourceType) Scan

func (ns *NullAuditRecordSourceType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuditRecordSourceType) Value

Value implements the driver Valuer interface.

type NullDNSRecordType

type NullDNSRecordType struct {
	DNSRecordType DNSRecordType
	Valid         bool // Valid is true if DNSRecordType is not NULL
}

func (*NullDNSRecordType) Scan

func (ns *NullDNSRecordType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullDNSRecordType) Value

func (ns NullDNSRecordType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullDNSStrategy

type NullDNSStrategy struct {
	DNSStrategy DNSStrategy
	Valid       bool // Valid is true if DNSStrategy is not NULL
}

func (*NullDNSStrategy) Scan

func (ns *NullDNSStrategy) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullDNSStrategy) Value

func (ns NullDNSStrategy) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Payload

type Payload struct {
	ID              int64     `db:"id"`
	UserID          int64     `db:"user_id"`
	Subdomain       string    `db:"subdomain"`
	Name            string    `db:"name"`
	CreatedAt       time.Time `db:"created_at"`
	NotifyProtocols []string  `db:"notify_protocols"`
	StoreEvents     bool      `db:"store_events"`
}

type PayloadsCreateParams

type PayloadsCreateParams struct {
	UserID          int64    `db:"user_id"`
	Subdomain       string   `db:"subdomain"`
	Name            string   `db:"name"`
	NotifyProtocols []string `db:"notify_protocols"`
	StoreEvents     bool     `db:"store_events"`
}

type PayloadsFindByUserAndNameParams

type PayloadsFindByUserAndNameParams struct {
	UserID int64  `db:"user_id"`
	Name   string `db:"name"`
	Limit  int64  `db:"limit"`
	Offset int64  `db:"offset"`
}

type PayloadsUpdateParams

type PayloadsUpdateParams struct {
	ID              int64    `db:"id"`
	Subdomain       string   `db:"subdomain"`
	UserID          int64    `db:"user_id"`
	Name            string   `db:"name"`
	NotifyProtocols []string `db:"notify_protocols"`
	StoreEvents     bool     `db:"store_events"`
}

type Querier

type Querier interface {
	AuditRecordsCreate(ctx context.Context, arg AuditRecordsCreateParams) (*AuditRecord, error)
	AuditRecordsGetByID(ctx context.Context, id int64) (*AuditRecord, error)
	AuditRecordsList(ctx context.Context, arg AuditRecordsListParams) ([]*AuditRecord, error)
	DNSRecordsCreate(ctx context.Context, arg DNSRecordsCreateParams) (*DNSRecord, error)
	DNSRecordsDelete(ctx context.Context, id *int64) error
	DNSRecordsDeleteAllByPayloadID(ctx context.Context, payloadID int64) ([]*DNSRecord, error)
	DNSRecordsDeleteAllByPayloadIDAndName(ctx context.Context, payloadID int64, name string) ([]*DNSRecord, error)
	DNSRecordsGetByID(ctx context.Context, id *int64) (*DNSRecord, error)
	DNSRecordsGetByPayloadID(ctx context.Context, payloadID int64) ([]*DNSRecord, error)
	DNSRecordsGetByPayloadIDAndIndex(ctx context.Context, payloadID int64, index int) (*DNSRecord, error)
	DNSRecordsGetByPayloadNameAndType(ctx context.Context, arg DNSRecordsGetByPayloadNameAndTypeParams) (*DNSRecord, error)
	DNSRecordsGetCountByPayloadID(ctx context.Context, payloadID int64) (int64, error)
	DNSRecordsUpdate(ctx context.Context, arg DNSRecordsUpdateParams) (*DNSRecord, error)
	EventsCreate(ctx context.Context, arg EventsCreateParams) (*Event, error)
	EventsGetByID(ctx context.Context, id int64) (*Event, error)
	EventsGetByPayloadAndIndex(ctx context.Context, payloadID int64, index int64) (*EventsGetByPayloadAndIndexRow, error)
	EventsListByPayloadID(ctx context.Context, arg EventsListByPayloadIDParams) ([]*EventsListByPayloadIDRow, error)
	HTTPRoutesCreate(ctx context.Context, arg HTTPRoutesCreateParams) (*HTTPRoute, error)
	HTTPRoutesDelete(ctx context.Context, id int64) error
	HTTPRoutesDeleteAllByPayloadID(ctx context.Context, payloadID int64) ([]*HTTPRoute, error)
	HTTPRoutesDeleteAllByPayloadIDAndPath(ctx context.Context, payloadID int64, path string) ([]*HTTPRoute, error)
	HTTPRoutesGetByID(ctx context.Context, id int64) (*HTTPRoute, error)
	HTTPRoutesGetByPayloadID(ctx context.Context, payloadID int64) ([]*HTTPRoute, error)
	HTTPRoutesGetByPayloadIDAndIndex(ctx context.Context, payloadID int64, index int) (*HTTPRoute, error)
	HTTPRoutesGetByPayloadMethodAndPath(ctx context.Context, arg HTTPRoutesGetByPayloadMethodAndPathParams) (*HTTPRoute, error)
	HTTPRoutesUpdate(ctx context.Context, arg HTTPRoutesUpdateParams) (*HTTPRoute, error)
	PayloadsCreate(ctx context.Context, arg PayloadsCreateParams) (*Payload, error)
	PayloadsDelete(ctx context.Context, id int64) (*Payload, error)
	PayloadsDeleteByNamePart(ctx context.Context, userID int64, name string) ([]*Payload, error)
	PayloadsFindByUserAndName(ctx context.Context, arg PayloadsFindByUserAndNameParams) ([]*Payload, error)
	PayloadsFindByUserID(ctx context.Context, userID int64) ([]*Payload, error)
	PayloadsGetAllSubdomains(ctx context.Context) ([]string, error)
	PayloadsGetByID(ctx context.Context, id int64) (*Payload, error)
	PayloadsGetBySubdomain(ctx context.Context, subdomain string) (*Payload, error)
	PayloadsGetByUserAndName(ctx context.Context, userID int64, name string) (*Payload, error)
	PayloadsUpdate(ctx context.Context, arg PayloadsUpdateParams) (*Payload, error)
	UsersCreate(ctx context.Context, arg UsersCreateParams) (*User, error)
	UsersDelete(ctx context.Context, id int64) error
	UsersGetAdmin(ctx context.Context) (*User, error)
	UsersGetByAPIToken(ctx context.Context, token string) (*User, error)
	UsersGetByID(ctx context.Context, id int64) (*User, error)
	UsersGetByLarkID(ctx context.Context, id string) (*User, error)
	UsersGetByName(ctx context.Context, name string) (*User, error)
	UsersGetBySlackID(ctx context.Context, id string) (*User, error)
	UsersGetByTelegramID(ctx context.Context, id int64) (*User, error)
	UsersList(ctx context.Context) ([]*User, error)
	UsersUpdate(ctx context.Context, arg UsersUpdateParams) (*User, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AuditRecordsCreate

func (q *Queries) AuditRecordsCreate(ctx context.Context, arg AuditRecordsCreateParams) (*AuditRecord, error)

func (*Queries) AuditRecordsGetByID

func (q *Queries) AuditRecordsGetByID(ctx context.Context, id int64) (*AuditRecord, error)

func (*Queries) AuditRecordsList

func (q *Queries) AuditRecordsList(ctx context.Context, arg AuditRecordsListParams) ([]*AuditRecord, error)

func (*Queries) DNSRecordsCreate

func (q *Queries) DNSRecordsCreate(ctx context.Context, arg DNSRecordsCreateParams) (*DNSRecord, error)

func (*Queries) DNSRecordsDelete

func (q *Queries) DNSRecordsDelete(ctx context.Context, id *int64) error

func (*Queries) DNSRecordsDeleteAllByPayloadID

func (q *Queries) DNSRecordsDeleteAllByPayloadID(ctx context.Context, payloadID int64) ([]*DNSRecord, error)

func (*Queries) DNSRecordsDeleteAllByPayloadIDAndName

func (q *Queries) DNSRecordsDeleteAllByPayloadIDAndName(ctx context.Context, payloadID int64, name string) ([]*DNSRecord, error)

func (*Queries) DNSRecordsGetByID

func (q *Queries) DNSRecordsGetByID(ctx context.Context, id *int64) (*DNSRecord, error)

func (*Queries) DNSRecordsGetByPayloadID

func (q *Queries) DNSRecordsGetByPayloadID(ctx context.Context, payloadID int64) ([]*DNSRecord, error)

func (*Queries) DNSRecordsGetByPayloadIDAndIndex

func (q *Queries) DNSRecordsGetByPayloadIDAndIndex(ctx context.Context, payloadID int64, index int) (*DNSRecord, error)

func (*Queries) DNSRecordsGetByPayloadNameAndType

func (q *Queries) DNSRecordsGetByPayloadNameAndType(ctx context.Context, arg DNSRecordsGetByPayloadNameAndTypeParams) (*DNSRecord, error)

func (*Queries) DNSRecordsGetCountByPayloadID

func (q *Queries) DNSRecordsGetCountByPayloadID(ctx context.Context, payloadID int64) (int64, error)

func (*Queries) DNSRecordsUpdate

func (q *Queries) DNSRecordsUpdate(ctx context.Context, arg DNSRecordsUpdateParams) (*DNSRecord, error)

func (*Queries) EventsCreate

func (q *Queries) EventsCreate(ctx context.Context, arg EventsCreateParams) (*Event, error)

func (*Queries) EventsGetByID

func (q *Queries) EventsGetByID(ctx context.Context, id int64) (*Event, error)

func (*Queries) EventsGetByPayloadAndIndex

func (q *Queries) EventsGetByPayloadAndIndex(ctx context.Context, payloadID int64, index int64) (*EventsGetByPayloadAndIndexRow, error)

func (*Queries) EventsListByPayloadID

func (q *Queries) EventsListByPayloadID(ctx context.Context, arg EventsListByPayloadIDParams) ([]*EventsListByPayloadIDRow, error)

func (*Queries) HTTPRoutesCreate

func (q *Queries) HTTPRoutesCreate(ctx context.Context, arg HTTPRoutesCreateParams) (*HTTPRoute, error)

func (*Queries) HTTPRoutesDelete

func (q *Queries) HTTPRoutesDelete(ctx context.Context, id int64) error

func (*Queries) HTTPRoutesDeleteAllByPayloadID

func (q *Queries) HTTPRoutesDeleteAllByPayloadID(ctx context.Context, payloadID int64) ([]*HTTPRoute, error)

func (*Queries) HTTPRoutesDeleteAllByPayloadIDAndPath

func (q *Queries) HTTPRoutesDeleteAllByPayloadIDAndPath(ctx context.Context, payloadID int64, path string) ([]*HTTPRoute, error)

func (*Queries) HTTPRoutesGetByID

func (q *Queries) HTTPRoutesGetByID(ctx context.Context, id int64) (*HTTPRoute, error)

func (*Queries) HTTPRoutesGetByPayloadID

func (q *Queries) HTTPRoutesGetByPayloadID(ctx context.Context, payloadID int64) ([]*HTTPRoute, error)

func (*Queries) HTTPRoutesGetByPayloadIDAndIndex

func (q *Queries) HTTPRoutesGetByPayloadIDAndIndex(ctx context.Context, payloadID int64, index int) (*HTTPRoute, error)

func (*Queries) HTTPRoutesGetByPayloadMethodAndPath

func (q *Queries) HTTPRoutesGetByPayloadMethodAndPath(ctx context.Context, arg HTTPRoutesGetByPayloadMethodAndPathParams) (*HTTPRoute, error)

func (*Queries) HTTPRoutesUpdate

func (q *Queries) HTTPRoutesUpdate(ctx context.Context, arg HTTPRoutesUpdateParams) (*HTTPRoute, error)

func (*Queries) PayloadsCreate

func (q *Queries) PayloadsCreate(ctx context.Context, arg PayloadsCreateParams) (*Payload, error)

func (*Queries) PayloadsDelete

func (q *Queries) PayloadsDelete(ctx context.Context, id int64) (*Payload, error)

func (*Queries) PayloadsDeleteByNamePart

func (q *Queries) PayloadsDeleteByNamePart(ctx context.Context, userID int64, name string) ([]*Payload, error)

func (*Queries) PayloadsFindByUserAndName

func (q *Queries) PayloadsFindByUserAndName(ctx context.Context, arg PayloadsFindByUserAndNameParams) ([]*Payload, error)

func (*Queries) PayloadsFindByUserID

func (q *Queries) PayloadsFindByUserID(ctx context.Context, userID int64) ([]*Payload, error)

func (*Queries) PayloadsGetAllSubdomains

func (q *Queries) PayloadsGetAllSubdomains(ctx context.Context) ([]string, error)

func (*Queries) PayloadsGetByID

func (q *Queries) PayloadsGetByID(ctx context.Context, id int64) (*Payload, error)

func (*Queries) PayloadsGetBySubdomain

func (q *Queries) PayloadsGetBySubdomain(ctx context.Context, subdomain string) (*Payload, error)

func (*Queries) PayloadsGetByUserAndName

func (q *Queries) PayloadsGetByUserAndName(ctx context.Context, userID int64, name string) (*Payload, error)

func (*Queries) PayloadsUpdate

func (q *Queries) PayloadsUpdate(ctx context.Context, arg PayloadsUpdateParams) (*Payload, error)

func (*Queries) UsersCreate

func (q *Queries) UsersCreate(ctx context.Context, arg UsersCreateParams) (*User, error)

func (*Queries) UsersDelete

func (q *Queries) UsersDelete(ctx context.Context, id int64) error

func (*Queries) UsersGetAdmin added in v1.27.0

func (q *Queries) UsersGetAdmin(ctx context.Context) (*User, error)

func (*Queries) UsersGetByAPIToken

func (q *Queries) UsersGetByAPIToken(ctx context.Context, token string) (*User, error)

func (*Queries) UsersGetByID

func (q *Queries) UsersGetByID(ctx context.Context, id int64) (*User, error)

func (*Queries) UsersGetByLarkID

func (q *Queries) UsersGetByLarkID(ctx context.Context, id string) (*User, error)

func (*Queries) UsersGetByName

func (q *Queries) UsersGetByName(ctx context.Context, name string) (*User, error)

func (*Queries) UsersGetBySlackID

func (q *Queries) UsersGetBySlackID(ctx context.Context, id string) (*User, error)

func (*Queries) UsersGetByTelegramID

func (q *Queries) UsersGetByTelegramID(ctx context.Context, id int64) (*User, error)

func (*Queries) UsersList

func (q *Queries) UsersList(ctx context.Context) ([]*User, error)

func (*Queries) UsersUpdate

func (q *Queries) UsersUpdate(ctx context.Context, arg UsersUpdateParams) (*User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type User

type User struct {
	ID         int64     `db:"id"`
	Name       string    `db:"name"`
	CreatedAt  time.Time `db:"created_at"`
	IsAdmin    bool      `db:"is_admin"`
	CreatedBy  *int64    `db:"created_by"`
	TelegramID *int64    `db:"telegram_id"`
	SlackID    *string   `db:"slack_id"`
	LarkID     *string   `db:"lark_id"`
	APIToken   *string   `db:"api_token"`
}

type UsersCreateParams

type UsersCreateParams struct {
	Name       string  `db:"name"`
	IsAdmin    bool    `db:"is_admin"`
	CreatedBy  *int64  `db:"created_by"`
	APIToken   *string `db:"api_token"`
	TelegramID *int64  `db:"telegram_id"`
	LarkID     *string `db:"lark_id"`
	SlackID    *string `db:"slack_id"`
}

type UsersUpdateParams

type UsersUpdateParams struct {
	ID         int64   `db:"id"`
	Name       string  `db:"name"`
	IsAdmin    bool    `db:"is_admin"`
	CreatedBy  *int64  `db:"created_by"`
	APIToken   *string `db:"api_token"`
	TelegramID *int64  `db:"telegram_id"`
	LarkID     *string `db:"lark_id"`
	SlackID    *string `db:"slack_id"`
}

Jump to

Keyboard shortcuts

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