db

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ENV_HOST         = "DGRAPH_DB_HOST"
	ENV_GRPC_PORT    = "DGRAPH_DB_GRPC_PORT"
	ENV_GRAPHQL_PORT = "DGRAPH_DB_GRAPHQL_PORT"
)
View Source
const (
	DefaultHost        = "localhost"
	DefaultGrpcPort    = "9080"
	DefaultGraphQLPort = "8080"

	DgraphAdminTokenHeader = "X-Dgraph-AuthToken"

	SchemaVersion = "v0.0.1"
)
View Source
const (
	IdPrefix  = "0x"
	IdPattern = `^[0-9a-fA-F]+$`
)

Variables

View Source
var (
	IdRegexp = regexp.MustCompile(IdPattern)
)

Functions

func BackgroundContext

func BackgroundContext(c context.Context) (context.Context, error)

func Commit

func Commit(ctx context.Context) error

func GetClient

func GetClient(ctx context.Context) (*dgo.Dgraph, error, context.Context)

func GetEndpoint

func GetEndpoint() string

func GetGraphQLClient

func GetGraphQLClient(ctx context.Context) (*graphql.Client, error, context.Context)

func GetGraphQLEndpoint

func GetGraphQLEndpoint() string

func GetGraphQLPort

func GetGraphQLPort() string

func GetGrpcPort

func GetGrpcPort() string

func GetHost

func GetHost() string

func GetTxn

func GetTxn(ctx context.Context) *dgo.Txn

func IdAddPrefix

func IdAddPrefix(id string) string

func IdDecToHex

func IdDecToHex(id string) string

func IdHexToDec

func IdHexToDec(id string) string

func IdTrimPrefix

func IdTrimPrefix(id string) string

func MigrateSchema

func MigrateSchema(ctx context.Context, fromVersion string, toVersion string) error

func NewClient

func NewClient() (*dgo.Dgraph, error)

func NewGraphQLClient

func NewGraphQLClient() (*graphql.Client, error)

func Rollback

func Rollback(ctx context.Context) error

func StartTxn

func StartTxn(ctx context.Context, readOnly ...bool) (context.Context, error)

func ValidId

func ValidId(id string, noPrefix ...bool) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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