utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Copyright (c) 2025 DaggerTech. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file. Package utils provides utility functions for converting values to SQL-compatible strings

Copyright (c) 2025 DaggerTech. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file. Package utils provides utility functions for working with pointers

Copyright (c) 2025 DaggerTech. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file. Package utils provides utility functions for time conversion between SQL and Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeValue

func MakeValue(value interface{}) (string, bool)

MakeValue converts a value to a SQL-compatible string representation Supports various types including bool, string, and time.Time Returns the SQL string and a boolean indicating success

@param value The value to convert @return A SQL-compatible string and a boolean indicating success

func Ptr

func Ptr[T any](value T) *T

Ptr returns a pointer to the provided value This is a generic helper function that works with any type

@param value The value to create a pointer to @return A pointer to the provided value

func SQLToTime

func SQLToTime(st string) (*time.Time, bool)

SQLToTime converts a SQL time string to a Go time.Time object Supports both " " and "T" as separators between date and time Returns a pointer to time.Time and a boolean indicating success

@param st The SQL time string to convert @return A pointer to the converted time.Time object, and a boolean indicating success

func TimeToSQL

func TimeToSQL(t time.Time) string

TimeToSQL converts a Go time.Time object to a SQL-compatible string format The format is "YYYY-MM-DD HH:MM:SS.NNNNNNNNN" where N is nanoseconds

@param t The time.Time object to convert @return A SQL-compatible string representation of the time

Types

This section is empty.

Jump to

Keyboard shortcuts

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