-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): NextWithHook with dynamic hook and logic for NotifyLinesExceed
- Loading branch information
Showing
10 changed files
with
189 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cast | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"go.breu.io/quantm/internal/hooks/slack/defs" | ||
) | ||
|
||
func ByteToMessageProviderSlackUserInfo(data []byte) (*defs.MessageProviderSlackUserInfo, error) { | ||
d := &defs.MessageProviderSlackUserInfo{} | ||
|
||
err := json.Unmarshal(data, d) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return d, nil | ||
} | ||
|
||
func ByteToMessageProviderSlackData(data []byte) (*defs.MessageProviderSlackData, error) { | ||
d := &defs.MessageProviderSlackData{} | ||
|
||
err := json.Unmarshal(data, d) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return d, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package utils | ||
|
||
import ( | ||
"github.com/google/uuid" | ||
) | ||
|
||
// NewUUID generates a new version 7 UUID. It returns an error if UUID generation fails. | ||
func NewUUID() (uuid.UUID, error) { | ||
return uuid.NewV7() | ||
} | ||
|
||
// MustUUID generates a new version 7 UUID. It panics if UUID generation fails. | ||
// | ||
// The only condition under which it could theoretically return an error is if the underlying system's source of | ||
// randomness is completely broken or unavailable. This is an exceptionally rare and serious system-level problem. It | ||
// would indicate a much deeper issue than just UUID generation. In practice, it almost certainly never going to fail. | ||
// That's why the MustUUID function, which panics on error, is generally considered acceptable in this specific context. | ||
// The panic implies a catastrophic failure of the system's random number generator, which is far more severe than a | ||
// simple UUID generation failure. A crash due to this problem is arguably preferable to silently generating a | ||
// non-unique or predictable UUID, leading to subtle and hard-to-debug issues. | ||
func MustUUID() uuid.UUID { | ||
id, err := NewUUID() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return id | ||
} | ||
|
||
// ParseUUID converts a string into a uuid.UUID and returns an error if invalid. | ||
func ParseUUID(input string) (uuid.UUID, error) { | ||
parsed, err := uuid.Parse(input) | ||
if err != nil { | ||
return uuid.Nil, err | ||
} | ||
|
||
return parsed, nil | ||
} |