Files
c000697835 MM-53962: Adding ES8 dependency (#24399)
* Adding ES8 dependency

```release-note
NONE
```


Co-authored-by: Mattermost Build <[email protected]>
2024-07-11 13:13:31 +05:30

21 lines
558 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
func NewBool(b bool) *bool { return &b }
func NewInt(n int) *int { return &n }
func NewInt64(n int64) *int64 { return &n }
func NewString(s string) *string { return &s }
func NewPointer[T any](t T) *T { return &t }
// SafeDereference returns the zero value of T if t is nil.
// Otherwise it return the derference of t.
func SafeDereference[T any](t *T) T {
if t == nil {
var t T
return t
}
return *t
}