DB

package
v0.8.35 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 21 Imported by: 35

Documentation

Index

Constants

View Source
const (
	DateLayout     = "2006-01-02"
	DatetimeLayout = "2006-01-02 15:04:05"
)

Supported date and datetime layouts

Variables

View Source
var DB *gorm.DB

Functions

func DBConnection added in v0.7.84

func DBConnection() *sql.DB

func Decrypt added in v0.7.84

func Decrypt(encryptedString string, passphrase string) (decryptedString string)

func Encrypt added in v0.7.84

func Encrypt(stringToEncrypt string, passphrase string) (encryptedString string)

Types

type Date added in v0.7.84

type Date struct {
	DateValue time.Time
	IsNotNull bool
}

Date provides a custom time type that can represent a date or datetime with a custom formatter.

func (*Date) GobDecode added in v0.7.84

func (date *Date) GobDecode(b []byte) error

GobDecode decodes the binary data from GobEncode into the Date type.

func (*Date) GobEncode added in v0.7.84

func (date *Date) GobEncode() ([]byte, error)

GobEncode encodes the Date type to a binary format for use with the gob package.

func (Date) GormDataType added in v0.7.84

func (date Date) GormDataType() string

GormDataType returns the data type that GORM should use for the Date type.

func (Date) MarshalJSON added in v0.7.84

func (date Date) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

func (*Date) Scan added in v0.7.84

func (date *Date) Scan(value interface{}) error

Scan scans the value from the database and sets the Date value.

func (*Date) String added in v0.7.84

func (date *Date) String() string

String returns the Date value in the custom format.

func (*Date) StringValue added in v0.7.84

func (date *Date) StringValue() string

StringValue returns the Date value as a string in the custom format.

func (*Date) Time added in v0.7.84

func (date *Date) Time() time.Time

Time returns the underlying time value of the Date type.

func (*Date) UnmarshalJSON added in v0.7.84

func (date *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON parses a JSON string in the custom format and sets the Date value.

func (Date) Value added in v0.7.84

func (date Date) Value() (driver.Value, error)

Value returns the database driver value for the Date type.

type SecureString added in v0.7.84

type SecureString string

func (*SecureString) Scan added in v0.7.84

func (s *SecureString) Scan(value interface{}) error

Scan implements the sql.Scanner interface, decrypting the string value.

func (SecureString) Value added in v0.7.84

func (s SecureString) Value() (driver.Value, error)

Value implements the driver.Valuer interface, encrypting the string value.

Jump to

Keyboard shortcuts

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