githubEdit

URL

The URL type handles web addresses using Go's net/url.URL with component parsing capabilities.

Overview

Property
Value

Go Type

url.URL / *url.URL

Database Schema

string / option<string> (with validation)

CBOR Encoding

Direct (as string)

Sortable

Yes

Definition

import "net/url"

type Bookmark struct {
    som.Node

    Title   string
    Link    url.URL   // Required
    Favicon *url.URL  // Optional
}

Schema

Generated SurrealDB schema with URL validation:

Creating URLs

Filter Operations

Equality Operations

Set Membership

Comparison Operations

Component Extraction

Extract URL components as string filters:

Nil Operations (Pointer Types Only)

Zero Value Check

Sorting

Method Chaining

URL filters support component extraction and string operations:

Common Patterns

Filter by Domain

Find API Endpoints

URLs with Specific Port

Bookmarks with Favicons

Complete Example

Filter Reference Table

Operation
Description
Returns

Equal(val)

Exact match

Bool filter

NotEqual(val)

Not equal

Bool filter

In(vals...)

Value in set

Bool filter

NotIn(vals...)

Value not in set

Bool filter

LessThan(val)

Lexicographic <

Bool filter

LessThanEqual(val)

Lexicographic <=

Bool filter

GreaterThan(val)

Lexicographic >

Bool filter

GreaterThanEqual(val)

Lexicographic >=

Bool filter

Domain()

Extract domain

String filter

Host()

Extract host with port

String filter

Port()

Extract port

String filter

Path()

Extract path

String filter

Query()

Extract query string

String filter

Fragment()

Extract fragment

String filter

Zero(bool)

Check empty URL

Bool filter

Truth()

To boolean

Bool filter

IsNil()

Is null (ptr)

Bool filter

IsNotNil()

Not null (ptr)

Bool filter

Last updated