GraphQL API and utilities for the rpdata project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package generate
import ( "fmt" "git.aiterp.net/rpdata/api/models" "time" )
// LogID generates a log ID in the format is 2019-05-22_191341547_RedrockAgency
func LogID(log models.Log) string { if len(log.ChannelName) < 1 { panic("ChannelName is not valid (validate input before calling this function!)") }
datetime := log.Date.UTC().Format("2006-01-02_150405") milliseconds := (log.Date.UnixNano() % int64(time.Second)) / 1000000 channelName := log.ChannelName[1:]
return fmt.Sprintf("%s%03d_%s", datetime, milliseconds, channelName) }
|