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

ticket

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ticket holds the support ticket rows (the ticket and ticket_follow tables), the ticket statuses and the follow types.

Index

Constants

View Source
const (
	Pending   = 1 // Pending  # Pending follow up
	Waiting   = 2 // Waiting  # Waiting for user response
	Processed = 3 // Processed
	Closed    = 4 // Closed
)
View Source
const (
	FollowText  = 1
	FollowImage = 2 // Content is an image reference rendered as <img src>
)

Follow types.

View Source
const FromUser = "User"

FromUser marks a follow written by the ticket's owner; the user client has always sent this value. Staff replies carry anything else ("System" from the admin panel, "admin" from the Telegram bot).

Variables

View Source
var ErrClosed = errors.New("ticket is closed")

ErrClosed reports a staff reply to a closed ticket. Closing ends the conversation for staff: a closed ticket takes no staff reply until it is explicitly reopened. The owner's reply is the exception and reopens it.

Functions

func IsFromUser added in v1.21.0

func IsFromUser(from string) bool

IsFromUser reports whether a follow was written by the ticket's owner. Older rows and callers spell the marker in lowercase or leave it empty.

Types

type Details

type Details struct {
	Id          int64     `gorm:"primaryKey"`
	Title       string    `gorm:"type:varchar(255);not null;default:'';comment:Title"`
	Description string    `gorm:"type:text;comment:Description"`
	UserId      int64     `gorm:"type:bigint;not null;default:0;comment:UserId"`
	Status      uint8     `gorm:"type:tinyint(1);not null;default:1;comment:Status"`
	Follows     []Follow  `gorm:"foreignKey:TicketId;references:Id"`
	CreatedAt   time.Time `gorm:"<-:create;comment:Create Time"`
	UpdatedAt   time.Time `gorm:"comment:Update Time"`
}

Details is a ticket with its follows preloaded, the view of the ticket detail pages; it is a query result, not a table of its own.

type Follow

type Follow struct {
	Id        int64     `gorm:"primaryKey"`
	TicketId  int64     `gorm:"type:bigint;not null;default:0;comment:TicketId"`
	From      string    `gorm:"type:varchar(255);not null;default:'';comment:From"`
	Type      uint8     `gorm:"type:tinyint(1);not null;default:1;comment:Type: 1 text, 2 image"`
	Content   string    `gorm:"type:text;comment:Content"`
	CreatedAt time.Time `gorm:"<-:create;comment:Create Time"`
}

func (Follow) TableName

func (Follow) TableName() string

type Ticket

type Ticket struct {
	Id          int64     `gorm:"primaryKey"`
	Title       string    `gorm:"type:varchar(255);not null;default:'';comment:Title"`
	Description string    `gorm:"type:text;comment:Description"`
	UserId      int64     `gorm:"type:bigint;not null;default:0;comment:UserId"`
	Status      uint8     `gorm:"type:tinyint(1);not null;default:1;comment:Status"`
	CreatedAt   time.Time `gorm:"<-:create;comment:Create Time"`
	UpdatedAt   time.Time `gorm:"comment:Update Time"`
}

func (Ticket) TableName

func (Ticket) TableName() string

Jump to

Keyboard shortcuts

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