Documentation
¶
Overview ¶
Package lookups provides static lookup data including country codes.
Index ¶
- Constants
- func Countries() []string
- func ID(ctx context.Context, db *sql.DB, t Table, name string) (int, error)
- func IDs(ctx context.Context, db *sql.DB, t Table, names ...string) ([]int, error)
- func Invalidate(db *sql.DB)
- func IsClosedStateType(typeName string) bool
- func IsPendingStateType(typeName string) bool
- func LoadCountries(configDir string) error
- func Name(ctx context.Context, db *sql.DB, t Table, id int) (string, error)
- func StateTypeNameOfState(ctx context.Context, db *sql.DB, stateID int) (string, error)
- type Table
Constants ¶
const ( StateTypeNew = "new" StateTypeOpen = "open" StateTypeClosed = "closed" StateTypePendingReminder = "pending reminder" StateTypePendingAuto = "pending auto" StateTypeRemoved = "removed" StateTypeMerged = "merged" )
OTRS ticket state type names.
const ( StateNew = "new" StateOpen = "open" StateClosedSuccessful = "closed successful" StateClosedUnsuccessful = "closed unsuccessful" StatePendingReminder = "pending reminder" StatePendingAutoPlus = "pending auto close+" StatePendingAutoMinus = "pending auto close-" StateRemoved = "removed" StateMerged = "merged" )
OTRS default ticket state names.
const ( SenderAgent = "agent" SenderSystem = "system" SenderCustomer = "customer" )
OTRS article sender type names.
const ( LockUnlock = "unlock" LockLock = "lock" LockTmpLock = "tmp_lock" )
OTRS ticket lock type names.
const ( ChannelEmail = "Email" ChannelPhone = "Phone" ChannelInternal = "Internal" ChannelChat = "Chat" )
OTRS communication channel names.
const ( // NewOpenStateIDsSQL: states of type new or open. NewOpenStateIDsSQL = stateIDsOfTypes + "('new', 'open')" // PendingStateIDsSQL: states of type pending reminder or pending auto. PendingStateIDsSQL = stateIDsOfTypes + "('pending reminder', 'pending auto')" // PendingReminderStateIDsSQL: states of type pending reminder. PendingReminderStateIDsSQL = stateIDsOfTypes + "('pending reminder')" // ClosedStateIDsSQL: states of type closed. ClosedStateIDsSQL = stateIDsOfTypes + "('closed')" // ViewableStateIDsSQL: OTRS Ticket::ViewableStateType default // (new, open, pending reminder, pending auto). ViewableStateIDsSQL = stateIDsOfTypes + "('new', 'open', 'pending reminder', 'pending auto')" // FinishedStateIDsSQL: states of type closed, removed or merged. FinishedStateIDsSQL = stateIDsOfTypes + "('closed', 'removed', 'merged')" )
SQL fragments selecting ticket_state ids by state type name. Use them inside `ticket_state_id IN (...)` / `NOT IN (...)`.
Variables ¶
This section is empty.
Functions ¶
func Countries ¶
func Countries() []string
Countries returns the currently loaded list of ISO country names.
func ID ¶ added in v0.10.0
ID returns the id of the row named name (case-insensitive) in table t. A cache miss reloads the table once, so rows added after the first load are found. Missing rows return an error wrapping sql.ErrNoRows.
func IDs ¶ added in v0.10.0
IDs resolves several names of one table; names that do not exist are skipped (an OTRS database may lack optional rows).
func Invalidate ¶ added in v0.10.0
Invalidate drops cached rows for db (all tables).
func IsClosedStateType ¶ added in v0.10.0
IsClosedStateType reports whether a state type name ends the ticket's life (closed, removed or merged).
func IsPendingStateType ¶ added in v0.10.0
IsPendingStateType reports whether a state type name is a pending type.
func LoadCountries ¶
LoadCountries loads the country list from the provided config directory overriding the embedded defaults.
Types ¶
type Table ¶ added in v0.10.0
type Table string
Table is a lookup table whose rows are resolved by name. Only these tables are accepted, so the table name can safely be part of the query text.
const ( StateType Table = "ticket_state_type" HistoryType Table = "ticket_history_type" SenderType Table = "article_sender_type" LockType Table = "ticket_lock_type" Channel Table = "communication_channel" LinkType Table = "link_type" LinkState Table = "link_state" LinkObject Table = "link_object" AutoResponse Table = "auto_response_type" FollowUp Table = "follow_up_possible" ValidLookup Table = "valid" StateLookup Table = "ticket_state" PriorityTable Table = "ticket_priority" TicketTypeTable Table = "ticket_type" )
Lookup tables with fixed, OTRS-defined row names.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package lookupstest provides test helpers for lookup numbering.
|
Package lookupstest provides test helpers for lookup numbering. |