atom / language-sql

SQL package for Atom
Other
38 stars 50 forks source link

Create Snippets #76

Open FelixVicis opened 5 years ago

FelixVicis commented 5 years ago

Prerequisites

Description

It would be awesome if this package added snippets in the same way that language-javascript did.

FelixVicis commented 5 years ago

Just a few that I've added to my own file are:

'.source.sql':
    'select all':
        'prefix': 'SELECTALL'
        'body': """
            SELECT ${1:*}
            FROM ${2:"tableName"}
            $3
        """
    'select one':
        'prefix': 'SELECT'
        'body':"""
            SELECT "${2:${1:table}_id}"
            FROM "${3:${1:table}s}"
            $4
        """
    'where':
        'prefix':'WHERE'
        'body':"""
            WHERE $1
        """
    'join':
        'prefix':'JOIN'
        'body':"""
            JOIN $1
        """
    'join as':
        'prefix':'JOINAS'
        'body':"""
            JOIN $1 as $2
        """
    'time now':
        'prefix':'NOW'
        'body':"""
            now()
        """