helper

package
v0.0.0-...-8aa1adc Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debugging bool

Debugging used for recording if the app is debugging mode.

Functions

func AllowedToRespond

func AllowedToRespond(parentCommentID, commenterClaimID string) error

AllowedToRespond checks if the creator of the comment will allow a response from the respondent

func CloseBody

func CloseBody(responseBody io.ReadCloser)

CloseBody used to catch and log errors from closing a response body

func CloseWriter

func CloseWriter(w io.WriteCloser)

CloseWriter used to catch and log errors from closing a writer

func CreateDigest

func CreateDigest(pieces ...[]byte) []byte

CreateDigest utility function for grouping multiple sets of bytes. Largely used for signature verification

func FindOrCreateChannel

func FindOrCreateChannel(channelClaimID, channelName string) (*model.Channel, error)

FindOrCreateChannel gets the channel from commentron database or creates it and returns it

func FindOrCreateSettings

func FindOrCreateSettings(creatorChannel *model.Channel) (*model.CreatorSetting, error)

FindOrCreateSettings gets the settings for the creator from commentron database or creates it and returns it

func FormatDur

func FormatDur(duration time.Duration) string

FormatDur returns a formatted duration

func GetIPAddressForRequest

func GetIPAddressForRequest(r *http.Request) string

GetIPAddressForRequest returns the real IP address of the request

func GetModerator

func GetModerator(modChannelID, modChannelName, creatorChannelID, creatorChannelName string) (*model.Channel, *model.Channel, error)

GetModerator returns the validated moderator and the creator which delegated the moderator. If a creator is not passed the moderator will be returned as the creator and will be equal.

func ReverseString

func ReverseString(s string) string

ReverseString reverses a string

func StringSplitArg

func StringSplitArg(stringToSplit, separator string) []interface{}

StringSplitArg splits CSV string into interface values that can be passed to SQLBoiler

Types

This section is empty.

Jump to

Keyboard shortcuts

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