Skip to content

Instantly share code, notes, and snippets.

@clone1018
Last active February 5, 2023 14:04
Show Gist options
  • Save clone1018/2ce2a664a0f4abbb53a0a5a2fd5b997a to your computer and use it in GitHub Desktop.
Save clone1018/2ce2a664a0f4abbb53a0a5a2fd5b997a to your computer and use it in GitHub Desktop.

Incoming Client Request

[
    "REQ", 
    "F56CF531-2376-4D7C-95D0-2D8F6BCCB061", 
    {
        "authors": [
            "3efdaebb1d8923ebd99c9e7ace3b4194ab45512e2be79c1b7d68d9243e0d2681", 
            "82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2",
            "foobar"
        ], 
        "kinds": [0]
    }, 
    {
        "authors": ["bec7203e9d101c34e06948e34769f1f63442df443b1a5b797f9a00ea43d739b4"], 
        "kinds": [3, 0]
    }, 
    {
        "#d": ["mute"], 
        "authors": ["bec7203e9d101c34e06948e34769f1f63442df443b1a5b797f9a00ea43d739b4"], 
        "kinds": [30000]
    }
]

Translated psuedo-sql

select * from events 
where
    # First El
    (
        
        (
            pubkey = "3efdaebb1d8923ebd99c9e7ace3b4194ab45512e2be79c1b7d68d9243e0d2681" 
            OR pubkey = "82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2"
            OR pubkey like "foobar%"
        )
        AND 
        (
            kind = 0 
        )
    )
    # Second El
    OR 
    (
        (
            pubkey = "bec7203e9d101c34e06948e34769f1f63442df443b1a5b797f9a00ea43d739b4"
        )    
        AND 
        ( 
            kind = 3 
            OR kind = 0
        )
    )
    # Third El
    OR 
    (
        (
            tags -> "#d" = "mute"
        )
        AND
        (
            pubkey = "bec7203e9d101c34e06948e34769f1f63442df443b1a5b797f9a00ea43d739b4"
        )
        AND
        (
            kind = 30000
        )
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment