# `AshNeo4j.Util`
[🔗](https://github.com/diffo-dev/ash_neo4j/blob/v0.7.0/lib/util.ex#L5)

AshNeo4j Util

# `base64_decode`

# `is_valid_edge_label?`

Validates that an atom is a valid Neo4j edge label (i.e. contains only uppercase letters and underscores)

## Examples
```
iex> AshNeo4j.Util.is_valid_edge_label?(:VALID_LABEL)
true
iex> AshNeo4j.Util.is_valid_edge_label?(:invalid_label)
false
```

# `is_valid_node_label?`

Validates that an atom is a valid Neo4j node label (i.e. starts with an uppercase letter and contains only letters and numbers)

## Examples
```
iex> AshNeo4j.Util.is_valid_node_label?(:ValidLabel)
true
iex> AshNeo4j.Util.is_valid_node_label?(:invalid_label)
false
```

# `is_valid_property_name?`

Validates that an atom is a valid Neo4j property name (i.e. does not start with a number and does not contain spaces or special characters)

## Examples
```
iex> AshNeo4j.Util.is_valid_property_name?(:validName)
true
iex> AshNeo4j.Util.is_valid_property_name?(:invalid_name)
false
```

# `json_decode`

# `json_encode`

Encodes json, converting structs and maps to ordered objects sorted by key, even when in lists/nested
Deliberately does not call Jason.Encoder on structs, since Protocol may not be implemented for persistence/at all

## Examples
```
iex> AshNeo4j.Util.json_encode(%{name: "Henry", age: 8, breed: :groodle})
{:ok, ~s({"age":8,"breed":"groodle","name":"Henry"})}
iex> AshNeo4j.Util.json_encode([%{currency: :aud, amount: 100}, %{currency: :sek, amount: 650}])
{:ok, ~s([{"amount":100,"currency":"aud"},{"amount":650,"currency":"sek"}])}
iex> AshNeo4j.Util.json_encode(%Ash.Union{type: :typed_struct, value: %AshNeo4j.Test.Type.DogTypedStruct{name: "Henry", age: 8, breed: "groodle"}})
{:ok, ~s({"type":"typed_struct","value":{"age":8,"breed":"groodle","name":"Henry"}})}
```

# `reverse`

Returns the reverse direction

# `short_name`

Returns the short name for an Elixir Module

## Examples
```
iex> AshNeo4j.Util.short_name(MyApp.Domain.User)
:User
```

# `to_camel_case`

Converts an Elixir snake_case atom to Neo4j camelCase atom, used for node properties

## Examples
```
iex> AshNeo4j.Util.to_camel_case(:snake_case)
:snakeCase
iex> AshNeo4j.Util.to_camel_case(:UUID)
:uuid
```

# `to_macro_case`

Converts an Elixir snake_case atom to Neo4j MACRO_CASE atom, used for edge labels

## Examples
```
iex> AshNeo4j.Util.to_macro_case(:snake_case)
:SNAKE_CASE
iex> AshNeo4j.Util.to_macro_case(:belongs_to)
:BELONGS_TO
```

# `to_pascal_case`

Converts an Elixir snake_case atom to Neo4j PascalCase atom, used for node labels

## Examples
```
iex> AshNeo4j.Util.to_pascal_case(:snake_case)
:SnakeCase
iex> AshNeo4j.Util.to_pascal_case(:domain)
:Domain
```

# `typed_struct?`

Whether the given module uses Ash.TypedStruct

## Examples
```
iex> AshNeo4j.Util.typed_struct?(AshNeo4j.Test.Type.DogTypedStruct)
true
iex> AshNeo4j.Util.typed_struct?(List)
false
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
